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.

classification
Title: Adjust class-build method of Enum so final ordered dict more closely resembles definition order
Type: behavior Stage: resolved
Components: Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: barry, eli.bendersky, ethan.furman
Priority: normal Keywords:

Created on 2016-09-09 18:26 by ethan.furman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg275374 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2016-09-09 18:26
With the landing of ordered class namespaces the build order for Enum needs to be redone to at least keep the user-specified pieces' relative order intact:

>>> from enum import Enum
>>> class Color(Enum):
...   red = 1
...   blue = 2
...   green = 3
...   def primary(self):
...     return True
... 
>>> Color.__dict__.keys()
dict_keys(['_generate_next_value_', '__module__', 'primary', '__doc__', '_member_names_', '_member_map_', '_member_type_', '_value2member_map_', 'red', 'blue', 'green', '__new__'])
msg276339 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2016-09-13 20:38
__definition_order__ was dropped from PEP520, so this issue is moot.
History
Date User Action Args
2022-04-11 14:58:36adminsetgithub: 72235
2016-09-13 20:38:35ethan.furmansetstatus: open -> closed
resolution: rejected
messages: + msg276339

stage: test needed -> resolved
2016-09-09 18:26:38ethan.furmancreate