summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-22 22:34:03 (GMT)
committerGitHub <noreply@github.com>2019-06-22 22:34:03 (GMT)
commit874ff65e0a70ff4fd1a67e85cd61d76adfcc219d (patch)
tree56f0a7d275a2283001ce6ca87168d000c995438c /Doc/reference
parentfa23bd286fb7719bd7601da0b713457589f5536f (diff)
downloadcpython-874ff65e0a70ff4fd1a67e85cd61d76adfcc219d.zip
cpython-874ff65e0a70ff4fd1a67e85cd61d76adfcc219d.tar.gz
cpython-874ff65e0a70ff4fd1a67e85cd61d76adfcc219d.tar.bz2
bpo-35224: Reverse evaluation order of key: value in dict comprehensions (GH-14139)
… as proposed in PEP 572; key is now evaluated before value. https://bugs.python.org/issue35224 (cherry picked from commit c8a35417db8853a253517a3e5190e174075c6384) Co-authored-by: Jörn Heissler <joernheissler@users.noreply.github.com>
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/expressions.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 8b71106..432327a 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -337,6 +337,12 @@ all mutable objects.) Clashes between duplicate keys are not detected; the last
datum (textually rightmost in the display) stored for a given key value
prevails.
+.. versionchanged:: 3.8
+ Prior to Python 3.8, in dict comprehensions, the evaluation order of key
+ and value was not well-defined. In CPython, the value was evaluated before
+ the key. Starting with 3.8, the key is evaluated before the value, as
+ proposed by :pep:`572`.
+
.. _genexpr: