Finding the instance reference of an object

Aaron Brady castironpi at gmail.com
Thu Oct 30 22:55:57 EDT 2008


On Oct 30, 9:05 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Fri, 31 Oct 2008 13:58:13 +1300, greg wrote:
> > Dale Roberts wrote:
>
snip
>
> > If they understand how assignment works in Python, that tells them all
> > they need to know.
>
> Nonsense.

Maybe I missed this part.  What does the phrase, "value of variable x"
mean in Python?  Is it the same as what it means in C, Pascal, etc.?

In other words,

>>> x= [ 2, 3, 4 ]
>>> '0x%x'%id( x )
'0xb39dd0'

What is the value of 'x'?
a) [ 2, 3, 4 ]
b) An object with contents [ 2, 3, 4 ]
c) 0xb39dd0
d) None of the above.

I hold that the burden of proof is yours if you hold that there is
more than one answer.

If "value of 'x'" is not defined, we should agree on a definition
that's really clear and useful, favoring useful.  After that's
established, we can proceed to evaluating what 'call by value' would
behave like, which would then determine if Python behaves like it.

So, logically, if... she... weighs... the same as a duck,... she's
made of wood.



More information about the Python-list mailing list