anything like C++ references?
tomas at fancy.org
Tue Jul 15 02:06:17 CEST 2003
Tom Plunket wrote:
> What I specifically want is a way to have a "second-level
> binding", e.g. a reference to a reference (assuming that the
> terminology is correct by saying that all Python variables are
> references). This is where I see the hole in Python, that there
> actually is a class of object that is different from everything
> else; you can bind to anything at all in the language...except
I just realized that this would be silly, complex, etc.
Say you could (as another poster mentioned) do something like
>>> 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. :)
More information about the Python-list