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

Chris Angelico rosuav at gmail.com
Fri Jun 14 19:56:05 EDT 2013


On Sat, Jun 15, 2013 at 5:33 AM, Grant Edwards <invalid at invalid.invalid> wrote:
> On 2013-06-14, Chris Angelico <rosuav at gmail.com> wrote:
>> 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.
>
> If you work with floating point long enough you realize that most of
> your expectations are wrong.  Sometimes.  Eventually.

NaN is like NULL in SQL. It's a weird beast. Just when you think
you've pinned it down, it slips out from under your taxonomic
classifications and thumbs its nose at you...

I think they're cousins to the platypus.

http://tvtropes.org/pmwiki/pmwiki.php/Main/EverythingsBetterWithPlatypi

ChrisA



More information about the Python-list mailing list