[docs] [issue35165] Possible wrong method name in attribute references doc

Steven D'Aprano report at bugs.python.org
Sun Nov 4 18:12:15 EST 2018


Steven D'Aprano <steve+python at pearwood.info> 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.

__getattribute__ is a more specialised method that is used by the interpreter at a deeper level. It is called on every attribute access, so it ought to be as fast as possible, while __getattr__ is only called if the named attribute doesn't exist.

I don't think anything needs to change here.

----------
nosy: +steven.daprano

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35165>
_______________________________________


More information about the docs mailing list