anything like C++ references?

Martin v. Löwis martin at
Tue Jul 15 06:56:56 CEST 2003

Stephen Horne <intentionally at> writes:

> Write...
>   x = classname()
>   y = x
> ... and that would be an error.
> However...
>   x = &classname()
>   y = x
> ... and everything is fine.

If any kind of implicit reference assignment would be an error, then I

x = classname()

would also be an error? because that assigns a reference of the object
to the implicit 'self' parameter of the method?

> > This is completely different from the notion of
> >values in C or C++, where each occurrence of the literal 5 creates a
> >new value whose state is 5.
> Not true. Each occurence of the literal 5 creates a new 'symbol' which
> represents the value 5. The immutability of values is preserved in
> C++.

That is not true. There are no "symbols" in C beyond those that you
use to name functions and global variables. Every occurrence of an
integer literal *does* create a temporary object, every time the
literal is *executed*.


More information about the Python-list mailing list