This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients barry, eli.bendersky, ethan.furman, serhiy.storchaka, vstinner
Date 2015-09-17.10:34:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442486075.15.0.588293962222.issue25147@psf.upfronthosting.co.za>
In-reply-to
Content
> This change has visible side effect: __members__ is no longer ordered.

This property of part of the PEP 435 (enum):
"The special attribute __members__ is an ordered dictionary mapping names to members."

IMHO if we really want to change this, it must be discussed on the python-dev mailing list.

To keep __members__ ordered, we can delay the creation of the OrderedDict at the first access to __members__: start with a dict, and use the ordered _all_member_names_ to created the ordered dictionary.

Attached patch implements this idea.

I checked enum.Enum and enum.IntEnum classes and the @enum.unique decorated: __members__ is not used to declare the class. Hum, I had to modify a little bit @enum.unique to not access __members__.
History
Date User Action Args
2015-09-17 10:34:35vstinnersetrecipients: + vstinner, barry, eli.bendersky, ethan.furman, serhiy.storchaka
2015-09-17 10:34:35vstinnersetmessageid: <1442486075.15.0.588293962222.issue25147@psf.upfronthosting.co.za>
2015-09-17 10:34:35vstinnerlinkissue25147 messages
2015-09-17 10:34:34vstinnercreate