Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4275

Re: NaN

From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: NaN
Date 2011-04-28 21:56 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <ipcnpm$m2s$1@reader1.panix.com> (permalink)
References <BANLkTine8W15e=SqNnJUStMNdy2GGA9pUA@mail.gmail.com> <mailman.945.1304010112.9059.python-list@python.org> <4db9b921$0$29978$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


On 2011-04-28, Steven D'Aprano <steve+comp.lang.python@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 ...

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: NaN Chris Rebert <clp2@rebertia.com> - 2011-04-28 10:01 -0700
  Re: NaN Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-28 18:59 +0000
    Re: NaN Terry Reedy <tjreedy@udel.edu> - 2011-04-28 17:23 -0400
    Re: NaN Grant Edwards <invalid@invalid.invalid> - 2011-04-28 21:56 +0000
  Re: NaN Grant Edwards <invalid@invalid.invalid> - 2011-04-28 20:39 +0000

csiph-web