NaN, Null, and Sorting

jmfauth wxjmfauth at gmail.com
Sat Jan 14 02:43:57 EST 2012


On 13 jan, 20:04, Ethan Furman <et... at stoneleaf.us> wrote:
> With NaN, it is possible to get a list that will not properly sort:
>
> --> NaN = float('nan')
> --> spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN]
> --> sorted(spam)
> [1, 2, nan, 3, nan, 4, 5, 7, nan]
>
> I'm constructing a Null object with the semantics that if the returned
> object is Null, it's actual value is unknown.
>

Short answer.

-  NaN != NA()

-  I find the actual implementation (Py3.2) quite satisfying. (M.
Dickinson's work)

jmf





More information about the Python-list mailing list