anything like C++ references?

Martin v. Löwis martin at v.loewis.de
Mon Jul 14 00:01:28 CEST 2003


Stephen Horne <intentionally at blank.co.uk> writes:

> >This just isn't true.  The C++ assignment operator is not at all like
> >the Python assignment statement.  Python variables are not like C++
> >variables, no surprise assignment is different too.  If you used
> >languages outside of C++ and its like (e.g., Pascal), you would find
> >Python's behavior common.
[...]
> The ability to change part or all
> of a value in-place has nothing to do with whether that value is
> referenced using a pointer or whatever in computer theory - any link
> between pointers/references and mutability should be related to the
> implementation of the language - not the semantics.

So you think "assignment" is about "changing values"? This is the case
in C and C++, but not the case in Java (atleast for objects), and Python.

In Python, assignment changes variables, not values. This is something
fundamentally different. In Python (and many other languages),
variables are independent of their value (and vice versa). Variables
are *associated* with a value, instead of *being* that value. Then,
assignment changes that association - not the value itself.

> So much for dropping out of the discussion, but I hate it when people
> make false claims about my beliefs, making me out to be ignorant, when
> it is *not* *me* who is missing the point.

I'm uncertain what your point is, however, I do observe that computer
theory has a different view of what assignments are than what I think
your view is.

Regards,
Martin




More information about the Python-list mailing list