object identity and equivalence

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Nov 20 13:42:16 CET 2001


Mon, 19 Nov 2001 18:44:16 -0000, Sandy Norton <sandskyfly at hotmail.com> pisze:

>>>> x = 10.0
>>>> y = 10.0
>>>> x is y
> 0

The result is different when the first two statements are written in
one line:

>>> x = 10.0; y = 10.0
>>> x is y
1

So identity of builtin immutable types is indeed very ill-defined.
It depends on line breaks. It depende whether statements are entered
interactively or they come from a script. And of course it may be
different in other versions of the interpreter.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^
QRCZAK



More information about the Python-list mailing list