On Wed, Jul 28, 2021 at 3:56 PM Yua <unch...@163.com> wrote: > > Thank you for bringing that to my attention! > > I think maybe can the interpreter decide whether __class__ etc. should be > added to the environment with regard to how the function is called? > > The interpreter does not provide __class__ etc. for plain placement() calls, > but provide them at calls like child().foo() - when the callee function is > named as a class method. Dynamically. >
No, because it can't know WHICH class it should be referencing. The entire point of the name __class__ is that it refers to the class being defined, so it has to be added at compilation time. 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/VOCITPCY3C6OIVGJWBEZ4UVV5SAQ4F3O/ Code of Conduct: http://python.org/psf/codeofconduct/