Python Forum
how to get around recursive method call - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to get around recursive method call (/thread-27969.html)

Pages: 1 2


RE: how to get around recursive method call - Skaperen - Jul-01-2020

the issue i have is when doing this in __getattribute__().
class ...:
    ...
    def __getattribute__(self,attr):
        print(f'looking up attribute {attr!r}',flush=True)
        return getattr(self,attr,None)
    ...

the general issue is how to wedge anything normally done in an instance of a class. the simple wedge of printing what happens and then do it seems hard in Python.