boolean OR gotcha

1x7y2z9 1x7y2z9 at gmail.com
Tue Aug 4 16:35:02 EDT 2009


Did not intend that there was a problem.
Just a gotcha or a fun little titbit ... maybe.  :)


On Aug 4, 1:25 pm, "Jan Kaliszewski" <z... at chopin.edu.pl> wrote:
> 04-08-2009 o 22:11:18 1x7y2z9 <1x7y... at gmail.com> wrote:
>
> > Another one (also explainable):
> >>>> 0 or None == None or 0
> > True
> > # Above is same as (operator precedence):
> >>>> 0 or (None == None) or 0
> > True
> > # Here is something different:
> >>>> (0 or None) == (None or 0)
> > False
>
> I don't see any problem here.
>
> The last is ok: None != 0.
>
> *j
> --
> Jan Kaliszewski (zuo) <z... at chopin.edu.pl>




More information about the Python-list mailing list