13 Jun
2022
13 Jun
'22
12:46 a.m.
On Mon, 13 Jun 2022 at 17:18, Steve Jorgensen <stevej@stevej.name> wrote:
One thing was not clear to me from the current PEP 671 text.
When that is used in a method, what is the closure for the expressions? Would/should assignments in the class definition be available or only global variables in the module and local variables in the function (if applicable) in which the class definition happens?
It's exactly the same as if the code got executed inside the function's body. It has access to the function's locals, but not to class scope (other than through cls.X or self.X). ChrisA