3 ms·
Indeed, this may or may not be clearer with the help of id() - observe: >>> v=2 >>> id(v) 4148001784 >>> id(2) 4148001784 >>> def m(a): ... a=3
by e12e 10y ago
Indeed, this may or may not be clearer with the help of id() - observe:
>>> v=2
>>> id(v)
4148001784
>>> id(2)
4148001784
>>> def m(a):
... a=3
...
>>> m(v)
>>> id(3)
4148001800
>>> id(v)
4148001784
>>> v
2
>>> l=[]
>>> id(l)
4140973392
>>> def m2(lst):
... lst.append(1)
...
>>> m2(l)
>>> l
[1]
>>> id(l)
4140973392