Passing by value instead of reference

Michael Hudson mwh21 at cam.ac.uk
Wed May 10 21:00:01 CEST 2000


"Jeff Massung" <jmassung at magpiesystems.com> writes:

> >Then what would you expect your "test" function to do?
> >
> >Cheers,
> >M.
> 
> Just print a different address. If test was:
> 
> def text(x):
>     x=1
> 
> test(z)
> print z
> 
> I would want this to print the original value of z (5), not 1.

It will.  I don't think you understand assigment yet...

Cheers,
M.

-- 
112. Computer Science is embarrassed by the computer.
     -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html



More information about the Python-list mailing list