anything like C++ references?

Bryan belred1 at yahoo.com
Sun Jul 13 18:42:21 EDT 2003


> 3.  Why is there no way to reference an immutable object via a
> pointer, other than stuffing it into a mutable object designed for
> some purpose other than simple pointer behaviour?
>

>>> a = (1, 2, 3)
>>> b = a
>>> id(a)
15471760
>>> id(b)
15471760
>>> print b[1]
2
>>>


i just referenced an immutable object via a "pointer" and i __did_not__
stuff it into a mutable object as you say.
a and b "point" to the same object.

bryan






More information about the Python-list mailing list