I’ve been experimenting in order to deepen my understanding of Python metaprogramming, and I have noticed a potentially useful behavior that I cannot find documentation to explain, so I don’t know whether it is safe to use and assume it will work in other Python versions and implementations. Specifically, I have found that if I have attributes of the same name on a class and its metaclass, both containing descriptors, then the metaclass descriptor will be used when the attribute is accessed through the class, the metaclass descriptor is employed, and when it is accessed through an instance, the class’ descriptor is employed. Does anyone know of any documentation that directly or indirectly explains why this behavior occurs? Continue reading...