Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b51b713

Browse files
authored
bpo-35224: Add What's new entry for evaluation order in dict comprehensions (GH-14319)
1 parent 36456df commit b51b713

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/whatsnew/3.8.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ Other Language Changes
349349
is ``-1``, and a suitable power of that inverse for other negative exponents.
350350
(Contributed by Mark Dickinson in :issue:`36027`.)
351351

352+
* When dictionary comprehensions are evaluated, the key is now evaluated before
353+
the value, as proposed by :pep:`572`.
354+
352355

353356
New Modules
354357
===========
@@ -1502,6 +1505,11 @@ CPython bytecode changes
15021505
when awaiting a next item in an :keyword:`async for` loop.
15031506
(Contributed by Serhiy Storchaka in :issue:`33041`.)
15041507

1508+
* The :opcode:`MAP_ADD` now expects the value as the first element in the
1509+
stack and the key as the second element. This change was made so the key
1510+
is always evaluated before the value in dictionary comprehensions, as
1511+
porposed by :pep:`572`. (Contributed by Jörn Heissler in :issue:`35224`.)
1512+
15051513

15061514
Demos and Tools
15071515
---------------

0 commit comments

Comments
 (0)