Loading topic
__init__. Later chapters build on the namespaces described her2 min read__dict__. It explains how Python decides which class to search first when an attribute is not on the instance.2 min read__dict__ and the method resolution order (MRO).2 min readobj.name goes through object.__getattribute__, which the previous chapter covered.2 min read__get__, __set__ and __delete__ are defined, and that you know an instance has its own __dict__ separate from its class. Here you will learn the one rule that decides whether a descriptor on a class beats an entry of the same name in the instance.2 min read__dict__ namespaces work, how the method resolution order (MRO) is built, and what __get__, __set__ and __delete__ do. Here they are combined into one algorithm.2 min read__get__ and __set__. You should also know that a data descriptor beats an entry of the same name in the instance __dict__.2 min readobj.name searches the instance __dict__ and the class, and that you have seen the descriptor protocol (__get__, __set__). Here the protocol explains something you use every day: why self is filled in automatically.2 min read__get__, __set__, __delete__), the difference between data and non-data descriptors, and the lookup order from the previous chapters.2 min read__get__ works, the difference between data and non-data descriptors, and the lookup order from earlier chapters. Here you will see how classmethod and staticmethod use that machinery.2 min readobject.__getattribute__ checks data descriptors, then the instance __dict__, then non-data descriptors and plain class attributes. Here you will see what happens when all of those fail.2 min readobj.name resolves through the type, the instance __dict__ and __getattr__. It also assumes you know the difference between data and non-data descriptors. Here you will see that __slots__ is an application of that same machinery.2 min read__dict__ and the instance __dict__ beats a non-data descriptor.2 min read__dict__, then non-data descriptor or class attribute. It also assumes you can read a simple metaclass declaration such as class Model(metaclass=Meta).2 min read__dict__, then a non-data descriptor or plain class attribute, then __getattr__. It also assumes you can write a descriptor with __get__, __set__ and `_setname__2 min read