On 2019-12-28 21:11, Richard Damon wrote:
<not addressing me>
You seem to understand Pure Math, but not the Applied Mathematics of
computers. The Applied Mathematics of Computing is based on the concept
of finite approximation, which is something that Pure Math, like the
type that builds up the Number line starting with Set Theory doesn't
handle approximation well. In Pure Math, something that is just mostly
true, and can be proved to not always be true, is considered False, but
to applied math, it can be good enough.

But that is the problem. "The applied mathematics of computing" is floating point, and in floating point, NaN is a number (despite its name). You can't have your cake and eat it too. You can say take the pure mathematical view that that NaN isn't a number, or you can say take the applied view that computers work with things (like floats) that aren't actually numbers but are similar to them. But what you seem to be trying to say is that computers work with things that aren't actually numbers (like floats), but that even so, NaN isn't one of those things, and that position just strikes me as senseless. The things that computers work with are floats, and NaN is a float, so in any relevant sense it is a number; it is an instance of a numerical type.

With regard to the larger issue of what statistics.median should do, I think the simplest solution is to just put an explicit warning in the docs that says "Results may be meaningless if your data contain NaN". I think it's fine to adopt a GIGO approach, but the problem is that the current docs aren't explicit enough about what counts as garbage, especially for the naive user. We don't have to worry about whether it's logically sufficient to say "the data must be orderable" or "the data must be numbers". The only case of practical relevance is the specific case of the single value NaN, so just put a specific note in the docs to specifically warn people about that specific value.

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
_______________________________________________
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/DHD34WLGQ4Y3WGLGZCB5PO2FXL37TNRS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to