anything like C++ references?

Tom Plunket tomas at
Tue Jul 15 02:18:40 CEST 2003

Michael Chermside wrote:

> > Assignment never copies anything, or creates anything except for 
> > changing the variable to point to a different address location.  
> > *Every* Python assignment (a=b) is like the C assignment (a=&b).  
> I have nothing whatsoever to add to this... it is just so clearly and
> simply stated that I felt it was worth repeating.

Although I don't think that it's correct.  Either a and b are
both pointer types or they're not- but IMHO it's much more useful
(perhaps) to C programmers to say "everything's a pointer" and
when you say

a = 5

You're saying the almost-C equivalent to 

a = &5;

If one considers that everything is a pointer, and that you
cannot necessarily change the object that the pointer points to
(there is no equivalent of

*a = 5

), then it actually becomes (hopefully) fairly straight-forward
to the C programmer.

So- it would probably be more helpful to C programmers to say
"everything is a pointer" rather than "everything is a
reference," and then add that "there is no pointer


More information about the Python-list mailing list