bpo-33609: small wording fixes to dict ordering docs

A few wording improvements to dict ordering documentation.
This commit is contained in:
Neil Schemenauer 2018-06-07 14:46:04 -07:00 committed by GitHub
parent e7adf2ba41
commit d3ed67d14e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4248,9 +4248,8 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise
:exc:`TypeError`. :exc:`TypeError`.
Dict preserves insertion order. Note that updating key doesn't affects the Dictionaries preserve insertion order. Note that updating a key does not
order. On the other hand, keys added after deletion are inserted to the affect the order. Keys added after deletion are inserted at the end. ::
last. ::
>>> d = {"one": 1, "two": 2, "three": 3, "four": 4} >>> d = {"one": 1, "two": 2, "three": 3, "four": 4}
>>> d >>> d
@ -4268,7 +4267,7 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
{'one': 42, 'three': 3, 'four': 4, 'two': None} {'one': 42, 'three': 3, 'four': 4, 'two': None}
.. versionchanged:: 3.7 .. versionchanged:: 3.7
Dict order is guaranteed to be insertion order. This behavior was Dictionary order is guaranteed to be insertion order. This behavior was
implementation detail of CPython from 3.6. implementation detail of CPython from 3.6.
.. seealso:: .. seealso::
@ -4307,7 +4306,7 @@ support membership tests:
a :exc:`RuntimeError` or fail to iterate over all entries. a :exc:`RuntimeError` or fail to iterate over all entries.
.. versionchanged:: 3.7 .. versionchanged:: 3.7
Dict order is guaranteed to be insertion order. Dictionary order is guaranteed to be insertion order.
.. describe:: x in dictview .. describe:: x in dictview
@ -4721,3 +4720,4 @@ types, where they are relevant. Some of these are not reported by the
.. [5] To format only a tuple you should therefore provide a singleton tuple whose only .. [5] To format only a tuple you should therefore provide a singleton tuple whose only
element is the tuple to be formatted. element is the tuple to be formatted.