classification
Title: Functional Programming HOWTO: Dictionary ordering isn't "essentially random"
Type: Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Stig Johan Berggren, docs@python, inada.naoki, miss-islington, rhettinger
Priority: normal Keywords: patch

Created on 2018-07-10 10:17 by Stig Johan Berggren, last changed 2018-07-11 11:21 by miss-islington. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8230 merged Stig Johan Berggren, 2018-07-10 19:51
PR 8246 merged miss-islington, 2018-07-11 09:54
Messages (6)
msg321375 - (view) Author: Stig Johan Berggren (Stig Johan Berggren) * Date: 2018-07-10 10:17
The section about iterators in the Functional Programming HOWTO (https://docs.python.org/3/howto/functional.html#data-types-that-support-iterators) states the following about looping over dictionary keys:

"Note that the order is essentially random, because it’s based on the hash ordering of the objects in the dictionary."

Starting with 3.7, dictionary order is guaranteed to be the same as insertion order.
msg321386 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-07-10 13:21
Thanks for noticing this.  Do you want to contribute a patch or would you like me to just fix it up?
msg321389 - (view) Author: Stig Johan Berggren (Stig Johan Berggren) * Date: 2018-07-10 16:04
I'll try to patch it myself.
msg321427 - (view) Author: Inada Naoki (inada.naoki) * (Python committer) Date: 2018-07-11 09:53
New changeset 5e5bbbec467a1569c914a048a94e7597528f92cf by INADA Naoki (Stig Johan Berggren) in branch 'master':
bpo-34083: Update dict order in Functional HOWTO (GH-8230)
https://github.com/python/cpython/commit/5e5bbbec467a1569c914a048a94e7597528f92cf
msg321428 - (view) Author: Inada Naoki (inada.naoki) * (Python committer) Date: 2018-07-11 09:59
Thanks, Stig.
And I'm sorry about I missed Raymond assigned himself.
msg321445 - (view) Author: miss-islington (miss-islington) Date: 2018-07-11 11:21
New changeset 151820e7a0ebe50b3d4fa64e22623c5470f1c56f by Miss Islington (bot) in branch '3.7':
bpo-34083: Update dict order in Functional HOWTO (GH-8230)
https://github.com/python/cpython/commit/151820e7a0ebe50b3d4fa64e22623c5470f1c56f
History
Date User Action Args
2018-07-11 11:21:54miss-islingtonsetnosy: + miss-islington
messages: + msg321445
2018-07-11 09:59:37inada.naokisetstatus: open -> closed
resolution: fixed
messages: + msg321428

stage: patch review -> resolved
2018-07-11 09:54:19miss-islingtonsetpull_requests: + pull_request7777
2018-07-11 09:53:09inada.naokisetnosy: + inada.naoki
messages: + msg321427
2018-07-11 06:34:33Stig Johan Berggrensetversions: + Python 3.8
2018-07-10 19:51:38Stig Johan Berggrensetkeywords: + patch
stage: patch review
pull_requests: + pull_request7768
2018-07-10 16:04:50Stig Johan Berggrensetmessages: + msg321389
2018-07-10 13:21:04rhettingersetassignee: docs@python -> rhettinger

messages: + msg321386
nosy: + rhettinger
2018-07-10 10:17:05Stig Johan Berggrencreate