On Mon, 13 Jun 2022 at 17:18, Steve Jorgensen <ste...@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
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/KPGQ5NYWVMAKV3MSZTF2L2THJTQRKUFD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to