Eval of expr with 'or' and 'and' within

Chris Angelico rosuav at gmail.com
Fri Jun 14 13:56:28 EDT 2013


On Sat, Jun 15, 2013 at 3:49 AM, MRAB <python at mrabarnett.plus.com> wrote:
> The general rule is that an object is true-ish unless it's false-ish
> (there are fewer false-ish objects than true-ish objects, e.g. zero vs
> non-zero int).

With a few random oddities:

>>> bool(float("nan"))
True

I somehow expected NaN to be false. Maybe that's just my expectations
that are wrong, though.

ChrisA



More information about the Python-list mailing list