Andrew Barnert writes:
> On Jun 26, 2019, at 21:45, Stephen J. Turnbull <email@example.com> wrote:
> > Chris Angelico writes:
> >> Then I completely don't understand getself. Can you give an example
> >> of how it would be used? So far, it just seems like an utter total
> >> mess.
> > It's possible that __getself__ would be implemented "halfway". That
> > is, if __getself__ is present, it is invoked, and performs *side
> > effects* (a simple example would be an access counter/logger for the
> > object). Then the compiler loads that object, discarding any return
> > value of the method. I think this is the semantics that the
> > proponents are thinking of.
> The compiler has to load the object before calling __getself__, not
> after, or it has nothing to call __getself__ on, right?
Correct. I should have said "leaves the object alone rather than
substituting the value of the method".
> Anyway, I don’t think this really avoids most of the problems.
Agreed. I just thought that it was worth clarifying that __getself__
could be entirely about side effects by definition.
> And I think everything else is an inherent consequence of trying to
> answer “I want to hook this operation on variables”
Yeah, I really don't understand why this is desirable in Python, but
if it is,
> “here’s an hook on values instead”
is not the way to do it. All roads lead to "We don't need a proof of
concept implementation, we need a proof of utility application."
Python-ideas mailing list -- firstname.lastname@example.org
To unsubscribe send an email to email@example.com
Message archived at https://firstname.lastname@example.org/message/VIQ52275FZIKMO4RVY4S6DW4IKTMDFRU/
Code of Conduct: http://python.org/psf/codeofconduct/