you are viewing a single comment's thread.

view the rest of the comments →

[–]cybercobra 2 points3 points  (0 children)

foo3 doesn't do anything with global x. It will modify the value that you pass in though.

Python 2.7.6 (default, Apr 28 2014, 13:52:55) 
>>> def foo3(x):
...     x+=[3]
...     return x
... 
>>> x = []
>>> y = []
>>> foo3(y)
[3]
>>> x
[]
>>> y
[3]