3 ms·
You have it right in that it's call by value. But HN already had a fight over that a while ago: http://news.ycombinator.com/item?id=4783229 http://news.ycombina
by Jach 14y ago
You have it right in that it's call by value. But HN already had a fight over that a while ago: http://news.ycombinator.com/item?id=4783229 http://news.ycombinator.com/item?id=4783229 (That I apparently won. :P)
- gsg 14y agoI see, people were mistaking the different nature of values in C and Python for a difference in calling semantics.
- d0mine 14y agoYou essentially changed the definition of "value" to mean what is just called "name" in Python. Names refer to objects. Names are introduced by name binding operations such as `=`, `import`, `def`. def f(a, b): # a, b - local variables a = [1] # doesn't change x list; a refers to the new list hence forth b.append(2) # change y list; b refers to the same list as y x, y = [], [] f(x, y) print x, y # [], [2] Note: a "win" doesn't change the truth. It just means that nobody cared enough to participate further in the hostile discussion.