INADA Naoki <songofaca...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue33863>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to