MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / __getattr__

Method __getattr__

example_code/item_061.py:70–77  ·  view source on GitHub ↗
(self, name)

Source from the content-addressed store, hash-verified

68print("Example 3")
69class LoggingLazyRecord(LazyRecord):
70 def __getattr__(self, name):
71 print(
72 f"* Called __getattr__({name!r}), "
73 f"populating instance dictionary"
74 )
75 result = super().__getattr__(name)
76 print(f"* Returning {result!r}")
77 return result
78
79data = LoggingLazyRecord()
80print("exists: ", data.exists)

Callers

nothing calls this directly

Calls 1

__getattr__Method · 0.45

Tested by

no test coverage detected