My question is: ID of the class and ID instance is the same, why is false when it is set to is?
class _Class:
def __init__(self):
self.result = 0
def testInstace(self, Instance1):
print("self id :", id(self))
print("inst id :", id(Instance1))
if(id(self) == id(Instance1)):
print("if is: ", id(self) is id(Instance1))
print("if ==: ", id(self) == id(Instance1))
print("type: ", type((self)), "\ttype", type((Instance1)))
if __name__ == '__main__':
cal1 = _Class()
cal1.testInstace(cal1)
result :
self id : 2098081049952
inst id : 2098081049952
if is: False
if ==: True
type: <class '__main__._Class'> type <class '__main__._Class'>