1 May
2013
1 May
'13
4:19 a.m.
Latest code available at https://bitbucket.org/stoneleaf/aenum. --> class Color(Enum): ... red = 1 ... green = 2 ... blue = 3 Enum items are virtual attributes looked by EnumType's __getattr__. The win here is that --> Color.red.green.blue no longer works. ;) Subclassing an implemented Enum class now raises an error (is there a better word than 'implemented'?) --> class MoreColor(Color): ... cyan = 4 ... magenta = 5 ... yellow = 6 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "./ref435.py", line 83, in __new__ raise EnumError("cannot subclass an implemented Enum class") ref435.EnumError: cannot subclass an implemented Enum class