Here is the code
class MyTest:
def __init__(self):
pass
def __getattr__(self, attr):
pass
t = MyTest()
print 'my test object: %r' %t
So print triggers a TypeError: 'NoneType' object is not callable
while i only want to see if object exists.
Granted this code isn't very useful. But i've had a stub class like that in a big code base so i did
if module and module.class and module.class.propery:
# do something with that property
...
and got a Type Error: 'NoneType' object is not callable
but the line doesn't call anything! I guess python is calling some functions implicitly behind the scenes.
Curiously this doesn't happen if the class inherits from Object
What's going on?