Vedran Čačić <ved...@gmail.com> added the comment:

Absolutely, but that's not my problem. I take your sentence to mean that when I 
do something with a _dict_ argument, it should try to preserve its insertion 
order as much as possible (given the semantics of the concrete method in 
question). I agree.

But my question is about constructing a dict from something other than a dict 
(here, a str, simply because it's easiest to visualize). I'm sure you don't 
mean to say dict.fromkeys retains the insertion order of its argument always, 
since it's obviously false if you give it a set.

What I'd like to be specified here (or elsewhere, but here I think it's useful) 
is that _iteration order_ of the argument to dict.fromkeys is preserved as 
_insertion order_ (and therefore iteration order) of the resulting dict. 
Besides, I don't see any other point where it should be specified... the only 
other constructor, `dict` itself, gives a very precise description 
(https://docs.python.org/3/library/stdtypes.html#dict) of how it creates a dict 
from its argument(s). Of course, there it mattered even before Py3.7, since 
values were important. In dict.fromkeys values are all the same, but order 
still matters and should (IMO) be specified.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45908>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to