getattro
getattro refers to the tp_getattro slot in CPython’s C API, a low-level hook that controls attribute lookup for objects of a custom type. When an attribute is accessed (for example, obj.name), the interpreter will invoke the type’s getattro function to obtain the attribute value if this slot is defined. If the tp_getattro slot is NULL, Python falls back to the default attribute lookup machinery.
The getattro function has a signature similar to PyObject* getattro(PyObject *self, PyObject *name). The name argument
Common reasons to implement getattro include providing custom storage for attributes, implementing computed or lazily-evaluated attributes,
Relationship to Python-level mechanics: getattro implements the C-level attribute lookup that corresponds to Python’s __getattribute__ mechanism.
In practice, getattro is a specialized tool for CPython extension authors to customize how attributes are retrieved,