常用状态做的一个集合,方便用在函数返回值中区分不同状态结果。
简单举例:
from iupdatable import Statusdef fun():print(\"do something\")abc = Trueif abc:return Status.okelse:return Status.failed
该类的完整代码:
from enum import IntEnumclass Status(IntEnum):ok = 0success = 1empty = -10null = -11none = -12undefined = -13unknown = -14failed = -20retry = -21exit = -22passed = 20checked = 21marked = 22flagged = 23found = 24next = 30continuing = 31breaking = 32on = 40off = -40valid = 41invalid = -41auto = 42manual = -42enable = 43disable = -43start = 44pause = 45stop = -44init = 60first = 61last = 62default = 63others = 64connected = 70disconnected = -70timeout = -71free = 72busy = -72added = 80existing = 81removed = 82confirm = 90ignore = 91cancel = 92debug = 100info = 101warning = -102exception = -103error = -104level0 = 1000level1 = 1001level2 = 1002level3 = 1003level4 = 1004level5 = 1005level6 = 1006level7 = 1007level8 = 1008level9 = 1009index0 = 1100index1 = 1101index2 = 1102index3 = 1103index4 = 1104index5 = 1105index6 = 1106index7 = 11071425index8 = 1108index9 = 1109
如果还有其它想添加的关键词,欢迎留言。