Yanghao Hua wrote:
this one, on the other hand, is truly generic and universal.
The problem is that it's *too* universal. A __getself__ method would be a sorcerer's-apprentice kind of magic that you can't escape when you don't want it. Suppose you want to inspect an object for debugging purposes. If it has a __getself__ method that returns something other than itself, it would be impossible to even look at it without it morphing into something else.
Isn't the top level itself a namespace? isn't every function local itself a namespace?
Yes, but namespace-based magic is confined to the namespace you define it on. The proposed object-based magic would be completely inescapable. -- Greg _______________________________________________ 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/DTUOIQGMFIFJSQCCKUNT4WV3III4R3M7/ Code of Conduct: http://python.org/psf/codeofconduct/