[Python-ideas] Specificity in AttributeError
Greg Ewing
greg.ewing at canterbury.ac.nz
Sun Apr 28 04:12:25 CEST 2013
Masklinn wrote:
> 1. __getattr__ is not implemented on object, thus implementing __getattr__
> in an inheritance hierarchy (where an other object in an MRO may also
> have implemented __getattr__) requires boilerplate
The same applies to any other special method that object
doesn't implement. What is it about __getattr__ that makes
it deserving of this treatment?
> I was wondering if it wouldn't be possible to add __getattr__ to object,
> which would return NotImplemented. And NotImplemented would be interpreted
> by the attribute resolution process as "raise the normal AttributeError"
That would make it impossible for NotImplemented
to be the value of any attribute of anything.
--
Greg
More information about the Python-ideas
mailing list