I implemented my own __getattr__()
to loosely handle any non-existent attributes.
I just so happened to define this class in a Jupyter notebook to experiment with it interactively.
IPython creates _ipython_canary_method_should_not_exist_
due to this __getattr__
implementation – and I'd like to understand what this is and how to "clean it up" is possible.
There is this issue opened about it, but it's not clear to my why – if it checks for permissive handling within __getattr__
– it doesn't check to see that _repr_html_ is implemented in the OP's example?
from types import SimpleNamespace
class Metabox(SimpleNamespace):
def __getattr__(self, name):
"""
Create a new namespace for any non-existing attributes.
"""
print("calling __getattr__")
self.__dict__[name] = Metabox()
return self.__dict__[name]