Skip to content

Commit 6c8cbb3

Browse files
[3.12] GH-109190: Copyedit 3.12 What's New: PEP 709 (GH-109656) (#109681)
(cherry picked from commit 22b70ca) Co-authored-by: Adam Turner <[email protected]>
1 parent 0015a9a commit 6c8cbb3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Doc/whatsnew/3.12.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,12 @@ PEP 709: Comprehension inlining
247247

248248
Dictionary, list, and set comprehensions are now inlined, rather than creating a
249249
new single-use function object for each execution of the comprehension. This
250-
speeds up execution of a comprehension by up to 2x.
250+
speeds up execution of a comprehension by up to two times.
251+
See :pep:`709` for further details.
251252

252-
Comprehension iteration variables remain isolated; they don't overwrite a
253+
Comprehension iteration variables remain isolated and don't overwrite a
253254
variable of the same name in the outer scope, nor are they visible after the
254-
comprehension. This isolation is now maintained via stack/locals manipulation,
255-
not via separate function scope.
256-
257-
Inlining does result in a few visible behavior changes:
255+
comprehension. Inlining does result in a few visible behavior changes:
258256

259257
* There is no longer a separate frame for the comprehension in tracebacks,
260258
and tracing/profiling no longer shows the comprehension as a function call.
@@ -271,7 +269,7 @@ Inlining does result in a few visible behavior changes:
271269
create a list of keys to iterate over: ``keys = list(locals()); [k for k in
272270
keys]``.
273271

274-
Contributed by Carl Meyer and Vladimir Matveev in :pep:`709`.
272+
(Contributed by Carl Meyer and Vladimir Matveev in :pep:`709`.)
275273

276274
.. _whatsnew312-pep688:
277275

0 commit comments

Comments
 (0)