[issue33863] Enum doc correction relating to __members__

INADA Naoki report at bugs.python.org
Fri Jun 15 00:11:27 EDT 2018


INADA Naoki <songofacandy at gmail.com> added the comment:

> A dictionary (treated as a synonym for dict) can't have an order different than insertion order, because that is one of the guarantees a *dictionary* provides.

When subclassing dict and overrides `__iter__` etc., the subclass is dict (isinstance(subclass, dict) is True) and it have order different than insertion order.

So when "dictionary" includes dict subclasses, it doesn't guarantee preserving insertion order.

Exact ``dict`` and ``OrderedDict`` guarantee insertion order, but when saying "dictionary", it's not guaranteed.


Anyway, word "dictionary" and "ordered dictionary" have vary meanings regarding to context.
So talking about general rule doesn't worth enough to use time and energy to discuss.  Let's focus on concrete cases.

For enum, I created pull request to change OrderedDict to dict. (PR-7698)

And for csv.DictReader, it uses OrderedDict already.  So I don't against changing "ordered dictionary" to OrderedDict.

----------

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


More information about the Python-bugs-list mailing list