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
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com