Passing by value instead of reference

Jeff Massung jmassung at magpiesystems.com
Wed May 10 15:33:52 EDT 2000


Michael Hudson wrote in message ...
>It will.  I don't think you understand assigment yet...
>

Sorry, I don't ;) - I was thinking like this (I understand how my previous
example was wrong).

>>> def test(x):
          x.append(3)
>>> z = [1,2]
>>> test(z)
>>> z
[1, 2, 3]
>>>

How can I get x to have the value of z, modify it, and use the modified
value, without z being modified overall? Thanks, guys ;)

Jeff





More information about the Python-list mailing list