Explanation of list reference

Marko Rauhamaa marko at pacujo.net
Sat Feb 15 07:07:35 EST 2014


Steven D'Aprano <steve+comp.lang.python at pearwood.info>:

> On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote:
>>    0. x is x
>>    1. if x is y then y ix x
>>    2. if x is y and y is z then x is z
>>    3. after x = y, x is y
>>    4. if x is y and x == x, then x == y
>>    5. id(x) == id(y) iff x is y
>
> # Counter-example
> py> x = 230000
> py> idx = id(x)
> py> del x
> py> y = 420000
> py> idy = id(y)
> py> idx == idy
> True

I don't accept that as a counterexample. You will have to produce:

   (id(x) == id(y)) == (x is y)
   > False

> (This is *implementation dependent* so your mileage my vary.)
>
>> Does that cover it?
>
> No. Your definition describes some properties of identity-equivalence,
> but doesn't explain what identity actually means.

That's the point. I don't think id() and "is" have any abstract meaning
on top of the formal axioms.


Marko



More information about the Python-list mailing list