Why c
and d
have the same memory id?
class A:
def __init__(self, number):
self.n = number
a = A(1)
b = A(1)
id(a) == id(b) # False
L1 = [1, 2, 3]
L2 = [1, 2, 3]
id(L1) == id(L2) # False
but
c = 1
d = 1
id(c) == id(d) # True