[issue33609] Document that dicts preserve insertion order
New submission from Yury Selivanov <yselivanov@gmail.com>: I don't see it documented that dicts preserve insertion order. 3.7 what's new points to [1], but that section doesn't have a "version changed" tag. IMO, [1] should have two version changed tags: one for 3.6, and one for 3.7. Also, it would be great if we could document how the order is preserved when a key is deleted from the dict etc. [1] https://docs.python.org/3.7/library/stdtypes.html#mapping-types-dict ---------- assignee: docs@python components: Documentation messages: 317346 nosy: docs@python, inada.naoki, ned.deily, vstinner, yselivanov priority: normal severity: normal status: open title: Document that dicts preserve insertion order type: enhancement versions: Python 3.7, Python 3.8 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Cheryl Sabella <cheryl.sabella@gmail.com> added the comment: As reference, issue32337 made some changes documenting that the dicts preserve insertion order. Also, issue33218 was marked as being superseded by #32337. ---------- nosy: +cheryl.sabella _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Ned Deily <nad@python.org> added the comment: I agree with Yury's suggestions; the entry in the "Dictionary view objects" section, that Cheryl points to, is not sufficient. Is somebody willing to write a PR? ---------- priority: normal -> high stage: -> needs patch type: enhancement -> _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Change by INADA Naoki <songofacandy@gmail.com>: ---------- keywords: +patch pull_requests: +6729 stage: needs patch -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Ned Deily <nad@python.org> added the comment: New changeset f822549653d8d09bffff5b7dcddfdf12679a787c by Ned Deily (INADA Naoki) in branch 'master': bpo-33609: Document dict insertion order guarantee as of 3.7 (GH-7093) https://github.com/python/cpython/commit/f822549653d8d09bffff5b7dcddfdf12679... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +7033 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 8585ec9b761947aae6be5f653a5b9ddef2801d58 by Miss Islington (bot) in branch '3.7': bpo-33609: Document dict insertion order guarantee as of 3.7 (GH-7093) https://github.com/python/cpython/commit/8585ec9b761947aae6be5f653a5b9ddef28... ---------- nosy: +miss-islington _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Neil Schemenauer <nas-python@arctrix.com> added the comment: The wording sounds strange to me. Currently it is:
Note that updating key doesn't affects the order ...
I would say:
Note that updating a key does not affect the order ...
---------- nosy: +nascheme _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Ned Deily <nad@python.org> added the comment: Neil, that looks like a perfect opportunity to use the GitHub web interface to make that edit :) ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Change by Neil Schemenauer <nas-python@arctrix.com>: ---------- pull_requests: +7110 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Neil Schemenauer <nas-python@arctrix.com> added the comment: New changeset d3ed67d14ed401dfe2b5d07b6941adc3ecacb268 by Neil Schemenauer in branch 'master': bpo-33609: small wording fixes to dict ordering docs https://github.com/python/cpython/commit/d3ed67d14ed401dfe2b5d07b6941adc3eca... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +7122 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Yury Selivanov <yselivanov@gmail.com> added the comment: New changeset 9b0d4d04a15a97a1055f1b729f14e9257f149fd3 by Yury Selivanov (Miss Islington (bot)) in branch '3.7': bpo-33609: small wording fixes to dict ordering docs (#7497) https://github.com/python/cpython/commit/9b0d4d04a15a97a1055f1b729f14e9257f1... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Eric Atkin <eatkin@omnisolutions.biz> added the comment: It seems the note at the bottom for `object.__hash__(self)` [1] should be updated as well. [1] https://docs.python.org/3/reference/datamodel.html#object.__hash__ ---------- nosy: +Eric Atkin _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
Inada Naoki <songofacandy@gmail.com> added the comment: GH-9807 fixed it. ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33609> _______________________________________
participants (8)
-
Cheryl Sabella
-
Eric Atkin
-
Inada Naoki
-
INADA Naoki
-
miss-islington
-
Ned Deily
-
Neil Schemenauer
-
Yury Selivanov