On 8/28/21 6:23 AM, Marc-Andre Lemburg wrote:
> To me, the behavior looked a lot like stripping NANs left and right
> from  the list, but what you're explaining makes this appear even more
> as a bug in the implementation of median() - basically wrong assumptions
> about NANs sorting correctly. The outcome could be more or less random, it
> seems.

It isn't a 'bug in median()' making the wrong assumption about NANs
sorting, it is an error in GIVING median a NAN which violates its
precondition that the input have a total-order by the less than operator.

Asking for the median value of a list that doesn't have a proper total
order is a nonsense question, so you get a nonsense answer.

It costs too much to have median test if the input does have a total
order, just to try to report this sort of condition, that it won't be
done for a general purpose operation.

-- 
Richard Damon

_______________________________________________
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/KHXUA6JWCC3LGWTBTQEEGKD6Z22YY345/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to