Ethan Furman added the comment:
Another approach to handling this, and other, issues is to allow options to
EnumMeta. My original aenum code had the default Enum class as unordered, no
duplicates allowed, non-indexable, etc., but then allowed options to be passed
in such as DUPLICATES to allow duplicates, ORDERED to add the ge-gt-le-lt
methods, INDEXED to add __index__, etc.
For the aliasing issue this method is more robust as placeholders are not
required, and code like this will work:
class Physics(Enum):
e = 2.81847
pi = 3.141596
tau = 2 * pi
To make that code work with placeholders is possible (I have it in aenum) but a
major pain (I was about to remove it before my offer to help with ref435 was
accepted).
----------
nosy: +ethan.furman
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17959>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com