Dynamic Attributes and Properties - MateuszMazurkiewicz/coding-and-learning GitHub Wiki

  • Interpreter calls __getattr__ and __setr__ to evaluate atribute access using dot notation (e.g. obj.attr). A user-defined class implementing __getattr__ can implement "virtual attributes" by computing values on the fly whenever somebody tries to read nonexistent attribute.