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.

classification
Title: Update language reference to specify that dict is insertion-ordered.
Type: Stage: resolved
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: AkechiShiro, Mariatta, docs@python, eric.snow, furkanonder, miss-islington, vstinner, zach.ware
Priority: normal Keywords: easy, patch

Created on 2020-03-06 18:33 by eric.snow, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19006 merged AkechiShiro, 2020-03-15 01:13
PR 19027 closed furkanonder, 2020-03-16 08:59
PR 19173 merged miss-islington, 2020-03-26 14:54
PR 19174 merged miss-islington, 2020-03-26 14:54
Messages (14)
msg363533 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2020-03-06 18:33
As of 3.7 [1], dict is guaranteed to preserve insertion order:

  the insertion-order preservation nature of dict
  objects has been declared to be an official part
  of the Python language spec.

However, at least one key part of the language reference [2] was not updated to reflect this:  "3.2. The standard type hierarchy" > "Mappings" > "Dictionaries".

Note that the library docs [3] *were* updated.


[1] https://docs.python.org/3/whatsnew/3.7.html#summary-release-highlights
[2] https://docs.python.org/3/reference/datamodel.html#index-30
[3] https://docs.python.org/3/library/stdtypes.html#typesmapping
msg364204 - (view) Author: Lahfa Samy (AkechiShiro) * Date: 2020-03-14 22:28
Hi, 

I would like to take this issue as my first contribution to Python, I'm currently subscribed to the python-core-mentorship list.
I do not know exactly how to submit a patch for an issue.

Kind regards.
msg364206 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2020-03-14 22:32
Patch are submitted as pull request on our GitHub repo.
Here's a write-up on how to do it
https://devguide.python.org/pullrequest/#step-by-step-guide
msg364229 - (view) Author: Lahfa Samy (AkechiShiro) * Date: 2020-03-15 12:01
Following the guide, I've send a patch with the fix, I'm waiting for a review. Once the patch will be reviewed and accepted. My patch will need to be backported from 3.9 to 3.7.
msg364303 - (view) Author: Furkan Onder (furkanonder) * Date: 2020-03-16 09:43
I sent pr. All tests passed successfully. If accepted, this will be my first contribution :)
https://github.com/python/cpython/pull/19027
msg364484 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2020-03-17 22:02
Hi Furkan.  Please note that Lahfa Samy had already submitted a PR for this issue after "claiming" it with a note here; proper "netiquette" suggests not jumping in with your own PR in such a situation.

Fortuitously though, it looks like the both of you have actually implemented about half of the final change that we need here :).  I'll be leaving review comments on both PRs; I recommend that the two of you work together to combine your PRs into a single PR with both of your (revised) changes.
msg364494 - (view) Author: Lahfa Samy (AkechiShiro) * Date: 2020-03-18 01:33
Hi Furkan, would you mind to combine your revised PR with mine so that we can do as suggested by Zachary?
msg364502 - (view) Author: Furkan Onder (furkanonder) * Date: 2020-03-18 07:26
Hello Samy,
I sent you pr from the docs-dict-ordered branch in your cpython repository. Now both of us have merged pr. I closed my own pr. You can also close your pr and send these changes again as bpo-39879.

It's my pr,https://github.com/AkechiShiro/cpython/pull/1
msg364520 - (view) Author: Lahfa Samy (AkechiShiro) * Date: 2020-03-18 14:08
Thank you for your quick work, I have successfully merged your changes in the branch of the first PR, now awaiting review from Zachary.
msg365080 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2020-03-26 14:54
New changeset 59c644eaa72b0cc48302f59d66852c4ea8332eba by Lahfa Samy in branch 'master':
bpo-39879: Update datamodel docs to include dict ordering (GH-19006)
https://github.com/python/cpython/commit/59c644eaa72b0cc48302f59d66852c4ea8332eba
msg365081 - (view) Author: miss-islington (miss-islington) Date: 2020-03-26 14:59
New changeset ea0eeb8d3a0544334f8836c98a761b2e3df2bd94 by Miss Islington (bot) in branch '3.7':
bpo-39879: Update datamodel docs to include dict ordering (GH-19006)
https://github.com/python/cpython/commit/ea0eeb8d3a0544334f8836c98a761b2e3df2bd94
msg365082 - (view) Author: miss-islington (miss-islington) Date: 2020-03-26 15:00
New changeset 96686c761d0587080effc113367431a0d396eb45 by Miss Islington (bot) in branch '3.8':
bpo-39879: Update datamodel docs to include dict ordering (GH-19006)
https://github.com/python/cpython/commit/96686c761d0587080effc113367431a0d396eb45
msg365083 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2020-03-26 15:01
Thanks for the patch!
msg365085 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-26 15:19
What's New in Python 3.7 says:

> the insertion-order preservation nature of dict objects has been declared to be an official part of the Python language spec.

Reference: https://mail.python.org/pipermail/python-dev/2017-December/151283.html

I just wanted to add a reference for this change. I wanted to check if it is ok to modify the doc: yes, it is :-)
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 84060
2020-03-26 15:19:26vstinnersetnosy: + vstinner
messages: + msg365085
2020-03-26 15:01:56zach.waresetstatus: open -> closed
resolution: fixed
messages: + msg365083

stage: patch review -> resolved
2020-03-26 15:00:50miss-islingtonsetmessages: + msg365082
2020-03-26 14:59:46miss-islingtonsetmessages: + msg365081
2020-03-26 14:54:45miss-islingtonsetpull_requests: + pull_request18534
2020-03-26 14:54:37miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request18533
2020-03-26 14:54:11zach.waresetmessages: + msg365080
2020-03-18 14:08:41AkechiShirosetmessages: + msg364520
2020-03-18 07:26:37furkanondersetmessages: + msg364502
2020-03-18 01:33:30AkechiShirosetmessages: + msg364494
2020-03-17 22:02:14zach.waresetnosy: + zach.ware
messages: + msg364484
2020-03-16 09:43:11furkanondersetmessages: + msg364303
2020-03-16 08:59:01furkanondersetnosy: + furkanonder
pull_requests: + pull_request18375
2020-03-15 12:01:24AkechiShirosetmessages: + msg364229
2020-03-15 01:13:27AkechiShirosetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request18351
2020-03-14 22:32:08Mariattasetnosy: + Mariatta
messages: + msg364206
2020-03-14 22:28:29AkechiShirosetnosy: + AkechiShiro
messages: + msg364204
2020-03-06 18:33:48eric.snowcreate