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, veky
Date 2021-11-27.08:02:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638000169.24.0.785616834749.issue45908@roundup.psfhosted.org>
In-reply-to
Content
I'm sure this is exactly how it should work, I just want to know if you think it is documented properly, so I can rely on it. In my opinion the docs should be more precise.

>>> ''.join(dict.fromkeys('axbxc'))
'axbc'

Is this guaranteed by the documentation? Of course, dict iteration order is now guaranteed to be insertion order, but still, nowhere do the docs say that fromkeys inserts the keys into new dictionary in order in which they appear in its argument.

(Probably the reason for this is that dict iteration order was fixed in 3.7, yet fromkeys existed a long time before that.)

I propose an addition to the documentation:

> Create a new dictionary with keys from iterable (in order) and values set to value.

https://docs.python.org/3/library/stdtypes.html
History
Date User Action Args
2021-11-27 08:02:49vekysetrecipients: + veky, docs@python
2021-11-27 08:02:49vekysetmessageid: <1638000169.24.0.785616834749.issue45908@roundup.psfhosted.org>
2021-11-27 08:02:49vekylinkissue45908 messages
2021-11-27 08:02:49vekycreate