Passing by value instead of reference
Fredrik Lundh
effbot at telia.com
Wed May 10 13:02:07 EDT 2000
Jeff Massung <jmassung at magpiesystems.com> wrote:
> >>> z=5
> >>> id(z)
> 6532920
> >>> def test(x):
> print id(x)
> >>> test(z)
> 6532920
>
> Is there a way to pass the value of z and not the address?
no.
and given that integers cannot be modified in place, I don't
really understand *why* you think you need to pass a copy
instead of a reference. maybe you can elaborate?
</F>
More information about the Python-list
mailing list