Mar-28-2018, 09:29 AM
>>> class A:
... pass
...
>>> class B:
... pass
...
>>> print(A.__dict__ is B.__dict__,A.__dict__ == B.__dict__,id(A.__dict__),id(B.__dict__))
False False 139925069297848 139925069297848
why id(A.__dict__) = id(B.__dict__),but A.__dict__ is not B.__dict__?
i think if id() function gives the same address for two objects,they must be the same object.
what is wrong here?
... pass
...
>>> class B:
... pass
...
>>> print(A.__dict__ is B.__dict__,A.__dict__ == B.__dict__,id(A.__dict__),id(B.__dict__))
False False 139925069297848 139925069297848
why id(A.__dict__) = id(B.__dict__),but A.__dict__ is not B.__dict__?
i think if id() function gives the same address for two objects,they must be the same object.
what is wrong here?