[Python-ideas] Eliminating special method lookup (was Re: Missing Core Feature: + - * / | & do not call __getattr__)

Guido van Rossum guido at python.org
Sat Dec 5 12:30:30 EST 2015


I wish there was less armchair language design and post-rationalization on
this topic, and more research into *why* we actually changed this. I recall
we did not take the decision lightly. Surely correlating the source control
logs and the mailing list archives can shed more insight on this topic than
thought experiments about classes with five special values. :-)

Patches to the reference manual are also very welcome, BTW. We're not proud
of the imprecision of much of the language there -- I would love for some
language lawyers to help tighten the language (not just on this topic but
all over the reference manual).

Finally. Regardless of what the reference manual may (not) say, other
implementations do *not* have the freedom to change the operator lookup to
look in the instance dict first. (However, giving the metaclass more
control is not unreasonable. There also seems to be some interesting
behavior here related to slots.)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151205/2eff04fd/attachment.html>


More information about the Python-ideas mailing list