anything like C++ references?

Stephen Horne intentionally at blank.co.uk
Mon Jul 14 00:07:21 EDT 2003


On 13 Jul 2003 21:43:41 -0400, aahz at pythoncraft.com (Aahz) wrote:

>In article <sag3hv4vf884ed7ouu5cv8ofnopp9j1t12 at 4ax.com>,
>Stephen Horne  <intentionally at blank.co.uk> wrote:
>>
>>In computer science, a variable is a named binding to a value.
>>Operations on that variable may rebind it to a different value, but
>>values don't change behind your back. A pointer is, in effect, a value
>>which indirectly refers to another (possibly anonymous) variable. A
>>pointer is something you specifically request, and by doing so you
>>allow that the 'variable' being indirectly referenced may be modified
>>by something else that has no direct access to your pointer value (via
>>your named variable or via copys or pointers-to your pointer held
>>elsewhere).
>>
>>Python should respect that.
>
>That's why I (and others) prefer to use "name" and "target" instead of
>"variable".  Would that assuage your ire?

Not really, for reasons defined elsewhere. The problem isn't
theoretical - it is practical, as shown by the fact that people do
trip over it time and time again. I'm just saying that the problem
arises out of peoples intuition of how variables should work - an
intuition that matches very well with theory.

If there is a clear concept of the right thing expressed in theory
which happens to match common intuitions, and if the wrong thing tends
to lead to subtle errors in functions that act differently depending
on whether the values passed in happen to be of mutable or immutable
types, all I can do is refer back to the arguments used against me
back in PEP238 when the majority *wanted* to make the massively
incompatible change on the grounds of theory, intuition and
reliability.





More information about the Python-list mailing list