summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 49b2ebf..6050b72 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -5191,9 +5191,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