NaN

Grant Edwards invalid at invalid.invalid
Thu Apr 28 17:56:06 EDT 2011


On 2011-04-28, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:

> While it is common, it is also an abuse of NANs to use it to
> represent missing values. In Python, that's (probably) best done with
> None.

None won't propogate through calculations to produce None's on outputs.

> The statistics language R has a specific value NA to use for missing,
> distinct from NANs.
>
> Still, it could be worse... I've seen a programs use 9999 to
> represent missing values, on the basis that nobody could ever have
> more than (say) 5000 invoices in the database... 

All 1's in a float is a NaN, so all 9's in a BCD value is a NaN.  Sort
of makes sense if the BCD operations propogate "all-nine" values or
raise exceptions when they are encountered (that's a big if).

-- 
Grant Edwards               grant.b.edwards        Yow! If elected, Zippy
                                  at               pledges to each and every
                              gmail.com            American a 55-year-old
                                                   houseboy ...



More information about the Python-list mailing list