Cheryl Sabella added the comment:
> Or maybe just link to
> https://docs.python.org/3/reference/datamodel.html#object.__getattr__ (which
> mention about it) will be enough.
In section 6.3.1, __getattr__() is already linked to the datamodel page
referenced.
As your suggested change is
Denis Osipov added the comment:
Got it.
But now docs says that overriding the __getattr__() method is enough to
customize attribute access. It's not completely true.
If I understand it correct, to make __getattr__() work every time you need to
call it by __getattribute__ or raise
Steven D'Aprano added the comment:
https://docs.python.org/3/reference/expressions.html#attribute-references
__getattr__ is the correct method to override in most (but not all) cases. I
don't think we should encourage people to override __getattribute__ as the
first resort.
New submission from Denis Osipov :
6.3.1. Attribute references says:
"The primary must evaluate to an object of a type that supports attribute
references, which most objects do. This object is then asked to produce the
attribute whose name is the identifier. This production can be customized