Modifying Class Object

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Feb 15 18:09:59 EST 2010


On Mon, 15 Feb 2010 21:25:23 +0000, Arnaud Delobelle wrote:

> John Posner <jjposner at optimum.net> writes: [...]
>>>   x = s[0]
> [...]
>>   assigns the name *x* to the object that *s[0]* refers to
> 
> s[0] does not refer to an object, it *is* an object (once evaluated of
> course, otherwise it's just a Python expression).

Precisely. Treated as an expression, that is, as a string being evaluated 
by the compiler, we would say that it *refers to* an object (unless 
evaluation fails, in which case it refers to nothing at all). But treated 
as whatever you get after the compiler is done with it, that is, post-
evaluation, we would say that it *is* an object.

This subtle distinction is essentially the difference between a label and 
the thing that is labeled.



-- 
Steven



More information about the Python-list mailing list