Consider the following:
class objectTest():
def __init__(self, a):
self.value = a
def get_value(self):
return self.value
class execute():
def __init__(self):
a = objectTest(1)
b = objectTest(1)
print(a == b)
print(a.get_value() == b.get_value)
print(a.get_value() == b.get_value())
print(a.get_value == b.get_value)
if __name__ == '__main__':
execute = execute()
This code return
>>>
False
False
True
False
Given that get_value is a function, I would expect the execution to stop and return an error, but it doesn't. Can somebody explain why the python interpreter allow this kind of syntax instead of raising an attribute error, which in my case would have saved me precious time.