From 38eb8cd495c2c1faedde23fd29792edba24daebf Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Sun, 15 Mar 2020 01:27:47 +0100 Subject: [PATCH 01/18] bpo-39879: Update docs dict preserve insertion order * Added in language reference that dict are now insertion-ordered since Python version 3.7 * Behavior of dict are now the same as the behavior of collections.OrderedDict --- Doc/reference/datamodel.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index c683d9991eb5ab..134991bfc00026 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -425,6 +425,8 @@ Mappings equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. + Contrary to older Python `see release notes of Python 3.7 : `_ versions (older than 3.7), the insertion-order is now preserved in a dict thus dict objects behaves the same way as `collection.OrderedDict `_. + Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). From fb8e1ca0ddc81b980d503aa2dc04e8b71ef752f1 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Sun, 15 Mar 2020 02:04:26 +0100 Subject: [PATCH 02/18] Fixed a typo --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 134991bfc00026..fad982e5294736 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -425,7 +425,7 @@ Mappings equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. - Contrary to older Python `see release notes of Python 3.7 : `_ versions (older than 3.7), the insertion-order is now preserved in a dict thus dict objects behaves the same way as `collection.OrderedDict `_. + Contrary to older Python `see release notes of Python 3.7 : `_ versions (older than 3.7), the insertion-order is now preserved in a dict thus dict objects behaves the same way as `collections.OrderedDict `_. Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). From 82f02505eaf57c6b9ae19d748475555185c40f82 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Sun, 15 Mar 2020 02:21:55 +0100 Subject: [PATCH 03/18] Replaced tabs by spaces --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index fad982e5294736..b663cb1b5431d2 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -425,7 +425,7 @@ Mappings equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. - Contrary to older Python `see release notes of Python 3.7 : `_ versions (older than 3.7), the insertion-order is now preserved in a dict thus dict objects behaves the same way as `collections.OrderedDict `_. + Contrary to older Python `see release notes of Python 3.7 : `_ versions (older than 3.7), the insertion-order is now preserved in a dict thus dict objects behaves the same way as `collections.OrderedDict `_. Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). From 9f34bb1f84d27c19f19e5930d14d13eaea7f80e6 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Mon, 16 Mar 2020 19:09:06 +0100 Subject: [PATCH 04/18] Added contributor name to Misc/ACKS --- Misc/ACKS | 1 + 1 file changed, 1 insertion(+) diff --git a/Misc/ACKS b/Misc/ACKS index 37cf7af0c2ec51..7b9d2c47590054 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -39,6 +39,7 @@ Ray Allen Billy G. Allie Jamiel Almeida Kevin Altis +Samy Lahfa Skyler Leigh Amador Joe Amenta Rose Ames From ca3eab0196cff1029231f724de7ab1cf95d71ed3 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2020 18:12:03 +0000 Subject: [PATCH 05/18] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst diff --git a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst new file mode 100644 index 00000000000000..a16c647d709be7 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst @@ -0,0 +1 @@ +Update docs dict preserve insertion order and added that thus dict object behaves the same as collections.OrderedDict objects. \ No newline at end of file From 07808ec98ac799998a454cf6384a7cbeac0e38f5 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 01:50:30 +0100 Subject: [PATCH 06/18] Applying requested changes * Fixed lines wrapping at 80 characters following devguide. * Removed unnecessary links. * Removed mention about OrderedDict. * Specified what is insertion order and how it works. --- Doc/reference/datamodel.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index b663cb1b5431d2..9b846b517d4f2f 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -424,10 +424,14 @@ Mappings for keys obey the normal rules for numeric comparison: if two numbers compare equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. - - Contrary to older Python `see release notes of Python 3.7 : `_ versions (older than 3.7), the insertion-order is now preserved in a dict thus dict objects behaves the same way as `collections.OrderedDict `_. - - Dictionaries are mutable; they can be created by the ``{...}`` notation (see + + Dictionaries preserve insertion order, meaning that keys will be produced + in the same order they were added sequencially over the dictionary. + Replacing an existing key does not change the order, however removing a key + and re-inserting it will add it to the end instead of keeping its old place. + Note that older Python versions dictionaries do not preserve insertion order. + + Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). .. index:: From d9458c32f55bfdc9d09fbe67e4930d87b094f629 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 02:01:44 +0100 Subject: [PATCH 07/18] Converting tabs to space --- Doc/reference/datamodel.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 9b846b517d4f2f..57a8125b6a8eac 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -424,11 +424,11 @@ Mappings for keys obey the normal rules for numeric comparison: if two numbers compare equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. - - Dictionaries preserve insertion order, meaning that keys will be produced - in the same order they were added sequencially over the dictionary. - Replacing an existing key does not change the order, however removing a key - and re-inserting it will add it to the end instead of keeping its old place. + + Dictionaries preserve insertion order, meaning that keys will be produced + in the same order they were added sequencially over the dictionary. + Replacing an existing key does not change the order, however removing a key + and re-inserting it will add it to the end instead of keeping its old place. Note that older Python versions dictionaries do not preserve insertion order. Dictionaries are mutable; they can be created by the ``{...}`` notation (see From 659094dca8d3399bb7f35671b3c27f15fad29870 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 02:15:02 +0100 Subject: [PATCH 08/18] Fix trailing whitespace/convert tabs to space --- Doc/reference/datamodel.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 57a8125b6a8eac..1a515233a40d9c 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -430,8 +430,8 @@ Mappings Replacing an existing key does not change the order, however removing a key and re-inserting it will add it to the end instead of keeping its old place. Note that older Python versions dictionaries do not preserve insertion order. - - Dictionaries are mutable; they can be created by the ``{...}`` notation (see + + Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). .. index:: From b4b48d8bc79ed28ab5780c7390d11a082ec1d789 Mon Sep 17 00:00:00 2001 From: furkanonder Date: Wed, 18 Mar 2020 10:18:57 +0300 Subject: [PATCH 09/18] update language reference to specify that dict is insertion-ordered. --- Doc/reference/datamodel.rst | 14 ++++++++------ Misc/ACKS | 1 + .../2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 1a515233a40d9c..ee9826e7a9d5fd 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -425,12 +425,14 @@ Mappings equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. - Dictionaries preserve insertion order, meaning that keys will be produced - in the same order they were added sequencially over the dictionary. - Replacing an existing key does not change the order, however removing a key - and re-inserting it will add it to the end instead of keeping its old place. - Note that older Python versions dictionaries do not preserve insertion order. - + .. versionchanged:: 3.7 + Dictionaries preserve insertion order, meaning that keys will be produced + in the same order they were added sequencially over the dictionary. + Replacing an existing key does not change the order, however removing a key + and re-inserting it will add it to the end instead of keeping its old place. + Note that older Python versions dictionaries do not preserve insertion order. + This behavior was an implementation detail of CPython from 3.6. + Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). diff --git a/Misc/ACKS b/Misc/ACKS index 7b9d2c47590054..a514abe2f5551c 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1236,6 +1236,7 @@ Jeffrey Ollie Adam Olsen Bryan Olson Grant Olson +Furkan Onder Koray Oner Piet van Oostrum Tomas Oppelstrup diff --git a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst index a16c647d709be7..d4b3f6066a58c2 100644 --- a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst +++ b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst @@ -1 +1,2 @@ -Update docs dict preserve insertion order and added that thus dict object behaves the same as collections.OrderedDict objects. \ No newline at end of file +Update docs dict preserve insertion order and added that thus dict object behaves the same as collections.OrderedDict objects. +Patch by Furkan Onder and Samy Lahfa. \ No newline at end of file From 4e893c68aef6407c3a1ba67d7b3815ea79c3d2f1 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 14:21:20 +0100 Subject: [PATCH 10/18] Revert "Docs dict ordered" --- Doc/reference/datamodel.rst | 8 -------- Misc/ACKS | 2 -- .../2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst | 2 -- 3 files changed, 12 deletions(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index ee9826e7a9d5fd..c683d9991eb5ab 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -425,14 +425,6 @@ Mappings equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. - .. versionchanged:: 3.7 - Dictionaries preserve insertion order, meaning that keys will be produced - in the same order they were added sequencially over the dictionary. - Replacing an existing key does not change the order, however removing a key - and re-inserting it will add it to the end instead of keeping its old place. - Note that older Python versions dictionaries do not preserve insertion order. - This behavior was an implementation detail of CPython from 3.6. - Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). diff --git a/Misc/ACKS b/Misc/ACKS index a514abe2f5551c..37cf7af0c2ec51 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -39,7 +39,6 @@ Ray Allen Billy G. Allie Jamiel Almeida Kevin Altis -Samy Lahfa Skyler Leigh Amador Joe Amenta Rose Ames @@ -1236,7 +1235,6 @@ Jeffrey Ollie Adam Olsen Bryan Olson Grant Olson -Furkan Onder Koray Oner Piet van Oostrum Tomas Oppelstrup diff --git a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst deleted file mode 100644 index d4b3f6066a58c2..00000000000000 --- a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update docs dict preserve insertion order and added that thus dict object behaves the same as collections.OrderedDict objects. -Patch by Furkan Onder and Samy Lahfa. \ No newline at end of file From ff04f7ea79b086b980df076c0c8e83d62fb42806 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 14:44:49 +0100 Subject: [PATCH 11/18] Revert "Revert "Docs dict ordered"" --- Doc/reference/datamodel.rst | 8 ++++++++ Misc/ACKS | 2 ++ .../2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index c683d9991eb5ab..ee9826e7a9d5fd 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -425,6 +425,14 @@ Mappings equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. + .. versionchanged:: 3.7 + Dictionaries preserve insertion order, meaning that keys will be produced + in the same order they were added sequencially over the dictionary. + Replacing an existing key does not change the order, however removing a key + and re-inserting it will add it to the end instead of keeping its old place. + Note that older Python versions dictionaries do not preserve insertion order. + This behavior was an implementation detail of CPython from 3.6. + Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). diff --git a/Misc/ACKS b/Misc/ACKS index 37cf7af0c2ec51..a514abe2f5551c 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -39,6 +39,7 @@ Ray Allen Billy G. Allie Jamiel Almeida Kevin Altis +Samy Lahfa Skyler Leigh Amador Joe Amenta Rose Ames @@ -1235,6 +1236,7 @@ Jeffrey Ollie Adam Olsen Bryan Olson Grant Olson +Furkan Onder Koray Oner Piet van Oostrum Tomas Oppelstrup diff --git a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst new file mode 100644 index 00000000000000..d4b3f6066a58c2 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst @@ -0,0 +1,2 @@ +Update docs dict preserve insertion order and added that thus dict object behaves the same as collections.OrderedDict objects. +Patch by Furkan Onder and Samy Lahfa. \ No newline at end of file From baf48b0684fdf59887fc313a10974247006f57f7 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 14:52:45 +0100 Subject: [PATCH 12/18] Delete trailling whitespace --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index ee9826e7a9d5fd..6f6255282a0c48 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -432,7 +432,7 @@ Mappings and re-inserting it will add it to the end instead of keeping its old place. Note that older Python versions dictionaries do not preserve insertion order. This behavior was an implementation detail of CPython from 3.6. - + Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). From 08fd18f54b42be49c9e03b0a787f742ec52f6ff5 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 14:57:56 +0100 Subject: [PATCH 13/18] fix more trailling whitespace --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 6f6255282a0c48..39980e6854d091 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -431,7 +431,7 @@ Mappings Replacing an existing key does not change the order, however removing a key and re-inserting it will add it to the end instead of keeping its old place. Note that older Python versions dictionaries do not preserve insertion order. - This behavior was an implementation detail of CPython from 3.6. + This behavior was an implementation detail of CPython from 3.6. Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). From 3c6b6445bbe41327c3e92f8734445e24e74db509 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 22:53:03 +0100 Subject: [PATCH 14/18] Requested changes fixes:versionchanged note moved at end of section --- Doc/reference/datamodel.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 39980e6854d091..f0e1baaf3f5e0c 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -425,13 +425,10 @@ Mappings equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index the same dictionary entry. - .. versionchanged:: 3.7 - Dictionaries preserve insertion order, meaning that keys will be produced - in the same order they were added sequencially over the dictionary. - Replacing an existing key does not change the order, however removing a key - and re-inserting it will add it to the end instead of keeping its old place. - Note that older Python versions dictionaries do not preserve insertion order. - This behavior was an implementation detail of CPython from 3.6. + Dictionaries preserve insertion order, meaning that keys will be produced + in the same order they were added sequencially over the dictionary. + Replacing an existing key does not change the order, however removing a key + and re-inserting it will add it to the end instead of keeping its old place. Dictionaries are mutable; they can be created by the ``{...}`` notation (see section :ref:`dict`). @@ -444,6 +441,10 @@ Mappings additional examples of mapping types, as does the :mod:`collections` module. + .. versionchanged:: 3.7 + Note that older Python versions dictionaries do not preserve insertion order. + This behavior was an implementation detail of CPython from 3.6. + Callable types .. index:: object: callable From f00776d9e5aba96a033d65241e73a01c8f129e0c Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 22:53:35 +0100 Subject: [PATCH 15/18] Update Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst Co-Authored-By: Zachary Ware --- .../Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst index d4b3f6066a58c2..6698ed607ca0ea 100644 --- a/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst +++ b/Misc/NEWS.d/next/Documentation/2020-03-16-18-12-02.bpo-39879.CnQ7Cv.rst @@ -1,2 +1,2 @@ -Update docs dict preserve insertion order and added that thus dict object behaves the same as collections.OrderedDict objects. -Patch by Furkan Onder and Samy Lahfa. \ No newline at end of file +Updated :ref:`datamodel` docs to include :func:`dict` insertion order preservation. +Patch by Furkan Onder and Samy Lahfa. From 8ab14209d608b4147de683866100c15f8e75855e Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 18 Mar 2020 23:00:16 +0100 Subject: [PATCH 16/18] Removed unecessary words --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index f0e1baaf3f5e0c..390d0d9e5296b4 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -442,7 +442,7 @@ Mappings module. .. versionchanged:: 3.7 - Note that older Python versions dictionaries do not preserve insertion order. + Older Python versions dictionaries do not preserve insertion order. This behavior was an implementation detail of CPython from 3.6. Callable types From df32abbbd63bcbf8b69b2f97eb98299f62934ca1 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Thu, 19 Mar 2020 20:38:30 +0100 Subject: [PATCH 17/18] Clarify and precise note --- Doc/reference/datamodel.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 390d0d9e5296b4..5037459a75af1a 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -442,8 +442,9 @@ Mappings module. .. versionchanged:: 3.7 - Older Python versions dictionaries do not preserve insertion order. - This behavior was an implementation detail of CPython from 3.6. + Dictionaries did not preserve insertion order in versions of Python before 3.6. + In CPython 3.6, insertion order was preserved, but it was considered + an implementation detail at that time rather than a language guarantee. Callable types .. index:: From c757a5e7366041094b48dba83a6c59a93cccd036 Mon Sep 17 00:00:00 2001 From: Lahfa Samy Date: Wed, 25 Mar 2020 20:03:28 +0100 Subject: [PATCH 18/18] Fix typo --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 5037459a75af1a..e91e855674dc5a 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -426,7 +426,7 @@ Mappings the same dictionary entry. Dictionaries preserve insertion order, meaning that keys will be produced - in the same order they were added sequencially over the dictionary. + in the same order they were added sequentially over the dictionary. Replacing an existing key does not change the order, however removing a key and re-inserting it will add it to the end instead of keeping its old place.