IsString

Mike Meyer mwm at mired.org
Wed Dec 14 21:44:28 EST 2005


Tom Anderson <twic at urchin.earth.li> writes:
>> Python does call by reference, which means that it passes pointers
>> to objects by value.
> That's not what call by reference is - call by reference is passing
> pointers to *variables* by value.

In which case, Python can't do call-by-reference at all, because it
doesn't have variable.

Of course, I think call-by-reference is passing references to
*objects* by value. 

> As a bonus, here's a similarly literal python translation of your C
> program:
>
>>>> i = 1
>>>> ref = "i"
>>>> i = 2
>>>> assert ref == "i"

I claim that's not correct, because ref can be used to change i in any
context in C. In your version, ref can only be used to change i if you
have access to the namespace that i lives in. In my version, ref can't
be used to change i at all.

   <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list