8000 gh-104374: don't inline comprehensions in non-function scopes by carljm · Pull Request #104519 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104374: don't inline comprehensions in non-function scopes #104519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update NEWS and What's New
  • Loading branch information
carljm committed May 16, 2023
commit 2c47a7551dd67263cce189ef4017463c914f19e9
7 changes: 4 additions & 3 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ New Features
PEP 709: Comprehension inlining
-------------------------------

Dictionary, list, and set comprehensions are now inlined, rather than creating a
new single-use function object for each execution of the comprehension. This
speeds up execution of a comprehension by up to 2x.
Dictionary, list, and set comprehensions occurring inside functions are now
inlined, rather than creating a new single-use function object for each
execution of the comprehension. This speeds up execution of a comprehension by
up to 2x.

Comprehension iteration variables remain isolated; they don't overwrite a
variable of the same name in the outer scope, nor are they visible after the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
:pep:`709`: inline list, dict and set comprehensions to improve performance
and reduce bytecode size.
:pep:`709`: inline list, dict and set comprehensions in functions to improve
performance and reduce bytecode size.
0