anything like C++ references?
intentionally at blank.co.uk
Tue Jul 15 05:34:01 CEST 2003
On Mon, 14 Jul 2003 17:06:17 -0700, Tom Plunket <tomas at fancy.org>
>>>> a = 5
>>>> b = ref_to(5)
>>>> a = 3
>>>> print b
>This would require a new built-in probably, and any time you
>(accidentally?) did 'b = c', then you'd lose that reference,
>but... hmm, I wonder if it'd be handy.
>Probably not enough to justify the expense. :)
True - but the problem doesn't arise if you need to explicitly
dereference pointers to access the objects they point to.
>>> a = 5
>>> b = &a
>>> a = 3
>>> *b = 7 # note - not 'b = c'
Providing the pointers aren't low level store addresses or fuzzy
concepts vaguely related to arrays as in C, the principle would work
More information about the Python-list