L
limodou
I found it puzzled me that:
class A:
def __getattr__(self, name):
return None
a=A()
b=A()
a==b will raise Exception:
__eq__
Traceback (most recent call last):
File "<pyshell#7>", line 1, in -toplevel-
a==b
TypeError: 'NoneType' object is not callable
I want to compare the objects themself not the attributes of them. But
it seems python invoke __getattr__ method, it's strange. How can I
compare the object directly without calling __getattr__?
Thankx
class A:
def __getattr__(self, name):
return None
a=A()
b=A()
a==b will raise Exception:
__eq__
Traceback (most recent call last):
File "<pyshell#7>", line 1, in -toplevel-
a==b
TypeError: 'NoneType' object is not callable
I want to compare the objects themself not the attributes of them. But
it seems python invoke __getattr__ method, it's strange. How can I
compare the object directly without calling __getattr__?
Thankx