[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

Michael Urman murman at gmail.com
Fri Apr 12 21:32:44 CEST 2013


On Fri, Apr 12, 2013 at 9:30 AM, Barry Warsaw <barry at python.org> wrote:

> On Apr 12, 2013, at 09:03 AM, Michael Urman wrote:
> >(For the latter behavior, would adding DupEnum.name2 = DupEnum.name1 after
> >the class declaration work today?)
>
> Yes, but the repr/str of the alias will show the original value.
>

That satisfies my concern. This gives an author the means to provide two
names for a single value, and a way to choose which one is canonical. It's
easy to imagine some corner cases related to persisting those values and
then retrieving them with a later enum definition that changes the
canonical name, but if you store raw values or names it should be easy
enough to work around such things.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130412/77378e57/attachment.html>


More information about the Python-Dev mailing list