Terry Reedy wrote at 2021-9-20 12:46 -0400:
>The second paragraph of the current exec entry
>https://docs.python.org/3.11/library/functions.html#exec
>ends with a sentence I wrote.
>
>"If exec gets two separate objects as globals and locals, the code will
>be executed as if it were embedded in a cl
On 9/20/21, Terry Reedy wrote:
>
> "If exec gets two separate objects as globals and locals, the code will
> be executed as if it were embedded in a class definition."
Note that, unlike exec(), the body of a class definition can modify
closure variables in nonlocal function scopes. For example:
The second paragraph of the current exec entry
https://docs.python.org/3.11/library/functions.html#exec
ends with a sentence I wrote.
"If exec gets two separate objects as globals and locals, the code will
be executed as if it were embedded in a class definition."
Would the following would be