osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Explanation of list reference


On Saturday, February 15, 2014 9:59:59 PM UTC+5:30, Marko Rauhamaa wrote:
> Steven D'Aprano:
> > Object identity is simple and well-defined in Python. I don't know why
> > you are so resistant to this. Read the documentation.

> It is not defined at all:

In a certain way thats what I am saying. But you are saying it
stronger than I would... See below

>    Every object has an identity, a type and a value. An object's
>    identity never changes once it has been created; you may think of it
>    as the object's address in memory. The 'is' operator compares the
>    identity of two objects; the id() function returns an integer
>    representing its identity.

> Thus "x and y are identical" *means* "x is y" and nothing else.

Formally yes.

But in practice, we (where we means experienced programmers and
presumably excludes persons like the OP) understand identity 
'somehow-or-other'

What does that 'somehow-or-other' consist of?

I would argue that we do that comprehending-act by translating to
a kind of C.  Maybe an informal, pidgin C but close enough that we get
(something of) the semantics.