diff options
| author | Donghee Na <donghee.na@python.org> | 2024-11-03 04:10:15 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-03 04:10:15 (GMT) |
| commit | 36079f702a8c1a8afea85cb0bbda57bc136cb911 (patch) | |
| tree | d529e5970592003c07ef0d9c0bf88fb627f0f328 /Python | |
| parent | 2f7793196a8feac9d5ce96ae0a8df0723ef1b044 (diff) | |
| download | cpython-36079f702a8c1a8afea85cb0bbda57bc136cb911.zip cpython-36079f702a8c1a8afea85cb0bbda57bc136cb911.tar.gz cpython-36079f702a8c1a8afea85cb0bbda57bc136cb911.tar.bz2 | |
[3.13] gh-125832: Clarify comment for inlined comprehensions as per PEP-709 (gh-126322) (gh-126344)
* gh-125832: Clarify comment for inlined comprehensions as per PEP-709 (#126322)
* Fix comprehensions comment to inlined by pep 709
* Update spacing
Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
* Add reference to PEP 709
---------
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
(cherry picked from commit 868bfcc02ed42a1042851830b79c6877b7f1c7a8)
* Add space
---------
Co-authored-by: rimchoi <hyerimc858@gmail.com>
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/compile.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c index d5c42ce..bf7e95e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5315,9 +5315,12 @@ ex_call: } -/* List and set comprehensions and generator expressions work by creating a - nested function to perform the actual iteration. This means that the - iteration variables don't leak into the current scope. +/* List and set comprehensions work by being inlined at the location where + they are defined. The isolation of iteration variables is provided by + pushing/popping clashing locals on the stack. Generator expressions work + by creating a nested function to perform the actual iteration. + This means that the iteration variables don't leak into the current scope. + See https://peps.python.org/pep-0709/ for additional information. The defined function is called immediately following its definition, with the result of that call being the result of the expression. The LC/SC version returns the populated container, while the GE version is |
