[Tutor] Pointers in python ??

Alan Gauld alan.gauld at btinternet.com
Sun Jan 20 17:17:21 CET 2008


"Michael H. Goldwasser" <goldwamh at slu.edu> wrote

>>    It does have the concept of C++ references however and in fact
>>    thats how Pyhon variables work. They are all references.

> However I strongly disagree with your suggestion that Python's
> variables work like C++ reference variables.

You are quite correct, I overstated the similarity, especially
in saying that they "work like" C++ references. I was really
only refering to the fact that in both cases the references
are to other variables/objects rather than to memory
locations. But the underlying semantics are quite different.

> reference variable must be initially bound to an existing object and
> that association cannot henceforth be changed.

But I had actually forgotten that references could not be reassigned.
My C++ is pretty rusty, I haven't used C++ much in the last 7
or 8 years! :-)

Thanks for the clarification Michael.

Alan G. 




More information about the Tutor mailing list