Message189024
Hmm, that's an interesting point about allowing operations on the already defined values.
You could get around that by requiring that the wrapper be explicit when definined the alias:
>>> class Shape(enum.Enum):
... rectangle = 1
... oblong = enum.alias(rectangle)
Or, equivalently:
>>> class Shape(enum.Enum):
... rectangle = 1
... oblong = enum.alias(1)
So simple typos would trigger an error by default, and the enum.alias wrapper would tell the namespace (or the metaclass) "hey, this should be an alias for another value already defined here".
I definitely don't want us to turn the metaclass into a swiss army knife of behavioural options - I'm happy with customisation hooks in the metaclass on that front, as I believe it is an effective way to discourage excessive use of metaclass magic without preventing it when it is necessary. |
|
Date |
User |
Action |
Args |
2013-05-12 12:44:41 | ncoghlan | set | recipients:
+ ncoghlan, eric.smith, alex, ethan.furman |
2013-05-12 12:44:41 | ncoghlan | set | messageid: <1368362681.81.0.301391018701.issue17959@psf.upfronthosting.co.za> |
2013-05-12 12:44:41 | ncoghlan | link | issue17959 messages |
2013-05-12 12:44:41 | ncoghlan | create | |
|