anything like C++ references?

Stephen Horne intentionally at blank.co.uk
Mon Jul 14 01:10:03 EDT 2003


On 13 Jul 2003 21:03:59 -0700, owski at hotmail.com (Adam Ruth) wrote:

>I don't see the arbitrary change.  Python has one type of variable: A
>pointer that cannot itself be dereferenced.  It's much more consistent
>then having 3 types of variables (in C++).

I answered most of these arguments elsewhere (significantly with an
admission of stupidity) but your assertion here about C++ is wrong.

C++ has precisely one type of variable. That variable is a placeholder
for a value of a datatype which is specified in the declaration. The
datatype may be a pointer datatype, but so what? Pointer datatypes are
not treated any differently than other datatype except that they, like
all datatypes, they have their own set of functionality.

C++ references are tellingly also called self-dereferencing pointers.
They are not a distinct concept - they are syntactic sugar. I suspect
they mainly arise out of the modern desire to disguise pointers and
fantasize that they're not there, though they certainly work very well
in certain contexts.

>> One way or the other, Python is currently choosing not to respect the
>> computer science definition of those terms. It may have historic and
>> backward-compatability reasons, but that does not change the facts.
>> This deviation from computer science definitions, whatever the excuse,
>> is arbitrary, confusing and error prone. That is my problem.
>
>It's not respecting the static language definitions of those terms,
>but it shouldn't even try.  There are different meanings for those
>words in mathematics, but you wouldn't try to express those
>definitions in terms of C, it would be equally frustrating.  The
>static definitions are merely abstractions of the mathematic meanings,
>and the dynamic meanings are also abstract, but in a different
>direction.

Funny thing. When I use algebra, the variables I define don't end up
referring to different values, functions or whatever unless I
explicitly redefine them. When I write a definition on one piece of
paper, the things I wrote earlier on another sheet don't change.

Seems to me that the math equivalent of assignment (defining named
things) works very much like the 'static language definitions' as you
put it.





More information about the Python-list mailing list