Raymond Hettinger added the comment:

-1 on this proposal.  We haven't really seen a need for this in practice.  And 
such as change would be likely create unforeseen consequences to existing code. 
 

The proposal is at odds with the existing design.  Python internals work by 
checking for whether a given slot is filled-out.  Trying to make these lookups 
transparent to __getattr__ calls would be tricky at best (we can't know what 
__getattr__ does without calling it) and definitely not fast.

Even if it could be done easily, I would still prefer the current design which 
requires explicit delegation of magic methods by proxy objects.

FWIW, me made the same decision for super() objects ( 
https://docs.python.org/3/library/functions.html#super ):

"""
Note that super() is implemented as part of the binding process for explicit 
dotted attribute lookups such as super().__getitem__(name). It does so by 
implementing its own __getattribute__() method for searching classes in a 
predictable order that supports cooperative multiple inheritance. Accordingly, 
super() is undefined for implicit lookups using statements or operators such as 
super()[name].
"""

For the reasons listed above and those listed by Steven, I'm marking this as 
closed/rejected.  Thank you for the suggestion, but we need to decline.

----------
assignee:  -> rhettinger
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30352>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to