Skip to content

Commit 22b70ca

Browse files
authored
GH-109190: Copyedit 3.12 What's New: PEP 709 (#109656)
1 parent 869f177 commit 22b70ca

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Doc/whatsnew/3.12.rst

+5-7
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,12 @@ PEP 709: Comprehension inlining
246246

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

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

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

273-
Contributed by Carl Meyer and Vladimir Matveev in :pep:`709`.
271+
(Contributed by Carl Meyer and Vladimir Matveev in :pep:`709`.)
274272

275273
.. _whatsnew312-pep688:
276274

0 commit comments

Comments
 (0)