Reference?

Michael Peuser mpeuser at web.de
Sat Aug 23 06:30:48 EDT 2003


"Kris Caselden" <google at hanger.snowbird.net> schrieb im Newsbeitrag
news:abc3fdd3.0308230057.6b309abd at posting.google.com...

> I've searched all the Python docs I could find, but I haven't seen any
> mention of referencing function arguments, such as you would with the
> & in c/c++. Is this possible in Python?

Your question is probably not as sophisticated: Parameter passing in Python
is *always* like & in C++.

There had been an exaustive disyussion some weeks ago: here is my
contribution:

Sent: Wednesday, August 13, 2003 9:12 AM
Subject: Re: two quick questions


> The following examples might clear the more theoretical elaborations .....
>
>
> def noUse(a):
>     a=(4,5,6)
>
> def tricky(a):
>     a[0]=(7,8,9)
>
> # case 1
> x=[1,2,3]
> print x
> tricky(x)
>
> x=(1,2,3)
> # case 2
> noUse(x)
> print x
>
> # case 3
> tricky([x])
> print x
>
> # case 4
> y=[x]
> tricky (y)
> print x
> print y[0]
>
> # case 5
> tricky(x)
> print x
>
>
> Kindly
> Michael Peuser






More information about the Python-list mailing list