anything like C++ references?

David Abrahams dave at boost-consulting.com
Mon Jul 14 03:02:49 CEST 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