[docs] [issue33862] doc Fix Enum __members__ type

Ethan Furman report at bugs.python.org
Thu Jun 14 15:55:45 EDT 2018


Ethan Furman <ethan at stoneleaf.us> added the comment:

Serhiy is correct.  The exact return type only needs to be ordered, and have appropriate dictionary methods such as `keys()`, `values()`, and `items()`.

The reason a mappingproxy was chosen is exactly because what you just tried is illegal and/or confusing:

- illegal because an Enum cannot be modified that way
- confusing because the dictionary returned is only a copy of the Enum class' __dict__, and successful attempts to modify it would not change the Enum class.

It is an implementation detail because the exact type of dictionary returned could change in the future.

----------
assignee: docs at python -> ethan.furman
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33862>
_______________________________________


More information about the docs mailing list