OMG! Thus is fun and all, but:

On Sat, Dec 28, 2019 at 9:11 PM Richard Damon <rich...@damon-family.org>
wrote:

>
> ... practicality beats purity.


And practically, everyone in this thread understands what a float is, and
what a NaN is and is not.

Richard: I am honestly confused about what you think we should do. Sure,
you can justify why the statistics module doesn’t currently handle NaN’s
well, but that doesn’t address the question of what it should do.

As far as I can tell,  the only reasons for the current approach is ease of
implementation and performance. Which are fine reasons, and why it was done
that way in the first place.

But there seems to be (mostly) a consensus that it would be good to better
handle NaNs in the statistics module.

I think the thing to do is decide what we want NaNs to mean: should they be
interpreting as missing values or, essentially, errors.

You’ve made a good case that None is the “right” thing to use for missing
values — and could be used with int and other types. So yes, if the
statistics module were to grow support for missing values, that could be
the way to do it.

Which means that NaNs should either raise an exception or return NaN as a
result. Those are options that are better than the current state.

Nevertheless, I think there is a practical argument for NaN-as-missing
value. Granted, it is widely used in other systems because it can be stored
in a float data type, and that is not required for Python. But it is widely
used, so is familiar to many.

But if we don’t go that route, it would be good to provide NaN-filtering
routines in the statistics module — as the related thread shows, NaN
detection is not trivial.

Frankly, I’m also confused as to why folks seem to think this is an issue
to be addressed in the sort() functions — those are way too general and low
level to be expected to solve this. And it would be a much heavier lift to
make a change that central to Python anyway.

-CHB


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/76RJEWYC7NUQ7QYSFTRP37EPWQNPSSQT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to