anything like C++ references?

Stephen Horne intentionally at blank.co.uk
Mon Jul 14 22:28:26 EDT 2003


On Mon, 14 Jul 2003 12:56:06 GMT, ivlenin at gmx.co.uk (I V) wrote:

>On Sun, 13 Jul 2003 20:39:56 +0100, Stephen Horne
><intentionally at blank.co.uk> wrote:
>
>>The fact is that 'assignment' has a common meaning separate from the
>>choice of programming language, and that the way Python handles name
>
>Yes.
>
>>binding means that meaning is not respected by Python for mutable
>>objects.
>
>No.
>
>Assignment takes a name and binds it to a different value, whatever
>programming language you use.

No.

We are in severely pedantic mode in this thread, because of the nature
of the argument.

'value' is a term which has meaning in mathematics and computer
science. Values are *always* immutable, whatever language you use.

In Python, assignment takes a name and binds it to an object (or a
pointer to that object).

In C/C++, assignment takes a name and binds it to a symbolic
representation of a value.

Objects can be mutable. Representations can be mutable. However, using
that mutability should respect the idea from mathematics of variables
binding to values. The fact that the binding is implemented using
objects or symbolic representations is irrelevant - they are low level
implementation details. You shouldn't have to worry about them in a
'very high level' language.

Of course if you explicitly ask to deal with the object (rather than
the value) that is a different thing. But that isn't the case in
Python. It fails to respect the mathematical concept of variables
binding to values BY DEFAULT. This regularly causes confusion and
errors.





More information about the Python-list mailing list