On Jun 26, 2019, at 13:53, Chris Angelico <ros...@gmail.com> wrote:

> Then in what circumstances will getself NOT be called? What is the
> point of having an object, if literally every reference to it will
> result in something else being used?

I think Yanghao has misunderstood the proposal. What Nate actually proposed is 
not that every time the value is accessed it calls __getself__, only accesses 
that are loads from a variable. The infinite regress problem is no worse than, 
say, __getattribute__ usually needing to call a method on super or object.

But if I’m right, then your initial refactoring point is still unanswered. You 
can return or otherwise use the value of self or the return of the uncloak 
function or whatever without triggering another call to __getself__, but if you 
refactor the return statement by storing an intermediate value in a temporary 
local variable, accessing that variable will trigger another call to 
__getself__. I assume Nate is working on an answer to that along with all the 
other points that have been raised.

_______________________________________________
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/72KYUGOAW7M33BHQ22LBOBYWVVHX4XVF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to