Problem with assigning variables of type List

Max M maxm at
Wed Aug 21 09:03:03 CEST 2002

To use your own quote:

Only the values of the arguments are passed and changes to the 
arguments within the called procedure have no effect on the actual 
arguments as seen by the caller.

And the example from Hans Nowak:

 >>> def foo(lst):
     lst.append(42)  <----- Has an effect on the actual arguments

 >>> a = [1,2,3]
 >>> a
[1, 2, 3]
 >>> foo(a)
 >>> a
[1, 2, 3, 42]

If you cannot see what is going on, I guess there is no point in further 

regards Max M

More information about the Python-list mailing list