Sybren Stuvel wrote:
> Dan Bishop enlightened us with:
> >>>> a = b = 1e1000 / 1e1000
> >>>> a is b
> > True
> >>>> a == b
> > False
>
> If "a is b" then they refer to the same object, hence a == b. It
> cannot be otherwise, unless Python starts to defy logic. I copied your
> code and got the expected result:
>
> >>> a = b = 1e1000 / 1e1000
> >>> a is b
> True
> >>> a == b
> True

Probably depends on the implementation.  1e1000/1e1000 yields a NaN
here, and I get True for "a is b" but False for "a==b".  Presumably
comparing a NaN for equality (any comparison?) always yields False.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to