The 8 things that happen at the "." between an object and the attribute1:30pm - 1:55pm on Saturday, October 7 in PennTop South
- Audience Level:
We rarely think about the dot “.” between our objects and their fields, but there are quite a lot of things that happen every time we use one in Python. This talk will include the commonly known functions, (dict, getattr, etc), but especially focus on the Descriptor Protocol.
We rarely think about the dot “.” between our objects and their fields, but there are quite a lot of things that happen every time we use one in Python. This talk will explore the details of what happens, how the descriptor protocol works, and how it can be used to alter the Python object model.
Actions to be explored:
- The instance dict is checked.
- The class dict is checked.
- The base classes dicts are checked.
- getattr runs.
- getattribute runs.
- The get method on the object in the class dict is called.
- The object in the class dict is checked for a set method.
- raise AttributeError
Most of the talk will focus on 6 & 7 to explain the Descriptor protocol. Examples will include altering method binding and property behaviors, as well as supporting method implementation reuse via Descriptors.