anything like C++ references?

Stephen Horne intentionally at blank.co.uk
Sun Jul 13 15:24:03 CEST 2003


On Sun, 13 Jul 2003 00:55:22 -0700, Erik Max Francis <max at alcyone.com>
wrote:

>Tom Plunket wrote:
>
>> IMHO the variable binding discussion doesn't answer the question,
>> it just provokes more questions.  :)
>
>But the answer to those questions is usually something ending with,
>"Look, Python just doesn't handle variables the same way C++ does."  :-)

And my traditional answer to that is... "yes, and the way that Python
handles variables is definitely a wart."

One of the few things I hate about Python is that mutable objects are
implicitly shared using a reference system whereas immutable objects
are not. It is unnecessarily confusing and error prone.

A system where all objects are copied unless a reference type is
explicitly applied (and with an assignment operators recognising
references on the LHS by default and assigns to the object rather than
the reference, though with an extra one which overwrites the
reference) seems much more logical to me. It even seems 'Pythonic' to
me. But it is much closer to C++ references than current Python
system.





More information about the Python-list mailing list