Package of modules that encapsulate the if else multi-condition judgment
Project description
ProjectName
ProjectName and Description
"优雅的if-else替换"
优化并美观你的if-else
探索本项目的文档 »
查看Demo
·
报告Bug
·
提出新特性
目录
文件目录说明
conditionevaluatortool
├── /conditionevaluator/
│ ├── __init__.py
│ ├── conditionevaluator.py
├── /test/
│ ├── __init__.py
│ ├── test.py
├── README.md
└── setup.py
上手指南
环境要求
- Python 3.7.0
安装依赖包
- pip install conditionevaluator
使用步骤
1.在需要做多条件判断的函数中引入装饰器
import conditionevaluator
@conditionevaluator
def doorType(door):
"""
条件1
:param door: 门类型 2 --> 双开门
:return: bool
"""
return "门类型错误"
2.其他函数调用
@doorType.register(1)
def params_door_type_1(door):
"""
条件1
:param door:
:return: False
"""
count = 1
return count
@doorType.register(2)
def params_door_type_2(door):
"""
条件2
:param door:
:return: True
"""
count = 2
return count
3.测试
if __name__ == '__main__':
print(params_door_type_2(1))
# 结果输出
>>> 2
使用到的框架
暂无
版本控制
该项目使用Git进行版本管理。您可以在repository参看当前可用版本。
作者
cywhat
- 🔗个人博客
鸣谢
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file conditionevaluator-1.0.1.tar.gz.
File metadata
- Download URL: conditionevaluator-1.0.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ffd59b24fdae40f67dd2bbe653363952614542408af6a8d4a442c9874b43d7e
|
|
| MD5 |
f99f34f12c9c962afab276122e5d5ef4
|
|
| BLAKE2b-256 |
1ea2f1b303dc1841b3dac56c0fde85377e98ec0a7d8c5bd9df72821dc5522543
|