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.

Author veky
Recipients docs@python, methane, rhettinger, veky
Date 2021-11-27.16:25:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638030315.41.0.546369170312.issue45908@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-11-27 16:25:15vekysetrecipients: + veky, rhettinger, methane, docs@python
2021-11-27 16:25:15vekysetmessageid: <1638030315.41.0.546369170312.issue45908@roundup.psfhosted.org>
2021-11-27 16:25:15vekylinkissue45908 messages
2021-11-27 16:25:15vekycreate