anything like C++ references?

David Abrahams dave at boost-consulting.com
Sun Jul 13 21:02:49 EDT 2003


Erik Max Francis <max at alcyone.com> writes:

> This is completely incorrect.  On the contrary, builtin types are
> handled exactly uniformly in Python.  The only difference here is that
> the builtin types that you've listed, along with some others, are
> immutable, so you cannot change them if you have a reference to them.

All you guys must be forgetting:

   >>> a = [1]
   >>> b = a
   >>> a += b
   >>> assert id(a) == id(b)
   >>> a = 1
   >>> b = a
   >>> a += b
   >>> assert id(a) == id(b)
   Traceback...

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Python-list mailing list