I am wanting to change
self.__getattr__ = self._getattr
def _getattr(self, attr):
def __getattr__(self, attr):
>>> at = AttrTest()
For special methods like
__getattr__, Python searches in the base(s)
__dict__, not in the instance
You can read more details about this in the special lookup section of the data model documentation.
I have two implementations of
__getattr__that each use a different type of serialization (json, pickle), and I wanted my class to be able to select one based on a kwarg.