Modifying Class Object

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Tue Feb 9 09:21:48 CET 2010


On Tue, 09 Feb 2010 08:19:56 +0100, Alf P. Steinbach wrote:

> You don't have anything /but/ pointers in Python.

x = 5
y = "hello"

You want us to accept that the values of x and y are some mysterious 
pointer entities rather than the integer object 5 and the string object 
"hello".

At the point that your explanation depends on the reader understanding 
that the value of a variable x is not actually the thing that they assign 
to x, but some mysterious, invisible entity that exists entirely inside 
the implementation where the user can never reach, you probably should 
rethink your attachment to that explanation. No wonder so many Java 
programmers are still confused by it.

It might help your case if we had a word for the thing that is actually 
assigned to the variable. In plain English that is "value", but you want 
to use that for the pointer to the thing-that-we-otherwise-would-call-
value, which leaves us no simple way to talk about the int 5 and string 
"hello".



-- 
Steven



More information about the Python-list mailing list