I know I can customize class attribute access by defining __getattr__
and __getattribute__
, but can I do it for a certain module?
For example, foo
is an imported module and x
is any name not defined in foo
. Can I make foo.x
return 'Hello' instead of Python throwing AttributeError, no matter what x
not defined in foo
is referenced?
Edit 03/12/2020
This feature was added to Python 3.7