Next / Previous / Contents / TCC Help System / NM Tech homepage

26.3.14. __getattr__(): Handle a reference to an unknown attribute

This method, if present, handles statements that get an attribute value of an instance, but there is no such entry in the instance's namespace. The calling sequence is:

    def __getattr__(self, name):

The argument is the name of the desired attribute. The method must either return the attribute's value or raise an AttributeError exception.

Compare Section 26.3.15, “__getattribute__(): Intercept all attribute references”, which is called even if the instance namespace does have an attribute with the desired name.