ended7월 23일· 1 sources

Python's Object Model in Depth: Why Two Lines That Look the Same Behave Differently

Why it matters

Two lines of code. Same variable. Same operator. Completely different behavior. a = [1, 2, 3] b = a b += [4] # line A print(a) # [1, 2, 3, 4] x = 1 y = x y += 1 # line B print(x) # 1 Line A changes a ...

1
Sources
+0
24h
Growth
60d
Active

Sources

Related Issues