[issue39443] Inhomogeneous behaviour for descriptors in between the class-instance and metaclass-class pairs

Raymond Hettinger report at bugs.python.org
Sun Jan 26 01:04:03 EST 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Some thoughts:

* The docs talk about descriptor invocation from "attribute access".  The reason they don't say "dotted access" is that the descriptors can be invoked in multiple ways: dotted access, getattr()/setattr() functions, super(), or direct calls to __getattribute__().

* From the point-of-view of descriptors, metaclasses aren't special.  The only essential fact needed is that type.__getattribute__() is called instead of object.__getattribute__().  The how-to guide already discusses how those methods differ.

* For now, I'm inclined to leave the docs as-is.  The existing coverage of common cases is already a bit hard to read.  It could become less readable if we list places where something doesn't happen, warnings to avoid features, or detailed explanations of uncommon cases like mixing metaclasses with descriptors.  If this arises again, we could add a FAQ entry of some such.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list