From: Alan G Isaac on
Surprising for a moment, if you don't
immediatelyrecognize it as a chained comparison.
(Just sharing.)
Alan Isaac

>>> None is None is None
True
>>> (None is None) is None
False
>>> None is (None is None)
False

From: Thomas Jollans on
On 06/25/2010 10:41 PM, Alan G Isaac wrote:
> Surprising for a moment, if you don't
> immediatelyrecognize it as a chained comparison.
> (Just sharing.)
> Alan Isaac
>
>>>> None is None is None
> True
>>>> (None is None) is None
> False
>>>> None is (None is None)
> False
>

Chained comparisons - one of those language features that some of the
time makes code enormously more readable, but the rest of the time are
rather disconcerting to those of us coming from pretty much any other
programming language.

Thomas
From: D'Arcy J.M. Cain on
On Sat, 26 Jun 2010 11:02:55 +0200
Thomas Jollans <thomas(a)jollans.com> wrote:
> On 06/25/2010 10:41 PM, Alan G Isaac wrote:
> >>>> None is None is None
> > True
> >>>> (None is None) is None
> > False
> >>>> None is (None is None)
> > False
>
> Chained comparisons - one of those language features that some of the
> time makes code enormously more readable, but the rest of the time are
> rather disconcerting to those of us coming from pretty much any other
> programming language.

And yet it's seems like the "One True Way" when you think of it. I
almost think that it should be...

>>> None is None
True
>>> None is None is None
Really True

:-)

--
D'Arcy J.M. Cain <darcy(a)druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.