Consider:
>>> def foo(a): a = 2
...
>>> x = 1
>>> foo(x)
>>> x
1
And:
>>> def bar(b): b.append(2)
...
>>> y = []
>>> bar(y)
>>> y
[2]
Alex Martelli dismisses newbie "by value or by reference" questions with the following:
The terminology problem may be due to the fact that, in python, the
value of a name is a reference to an object. So, you
(
Read more... )