For the class Thing, when I call an undefined method such as .doamethod()...
class Thing:
def __init__(self):
pass
def __getattr__(self, method):
print('Run method: '+method)
t = Thing()
t.doamethod()
...I get this output:
Run method: doamethod
Traceback (most recent call last):
File "C:\Users\person\classtest.py", line 9, in <module>
t.doamethod()
TypeError: 'NoneType' object is not callable
Since the text Run method: doamethod was printed I know the contents of __getattr__ ran (which is good, I want this) but it also raised TypeError: 'NoneType' object is not callable. Why?