On 12/29/19 8:13 PM, David Mertz wrote:
On Sun, Dec 29, 2019 at 8:00 PM Richard Damon
<rich...@damon-family.org <mailto:rich...@damon-family.org>> wrote:
Which is EXACTLY the reason I say that if this is important enough to
fix in median, it is important enough to fix in sorted. sorted gives
exactly the same nonsense result, it is only a bit more obvious
because
it gives all the points. Is [3, nan, 1, 2, 4] a sorted list?
As me and Uncle Timmy have pointed out, it IS FIXED in sorted(). You
just need to call:
sorted_stuff = sorted(stuff, key=nan_aware_transform)
Guido's time machine to the rescue... you've had this for more than a
decade now.
So we just need to make available a suitable key function, and because
this issue was aimed at confusion for inexperienced users, make it the
default sorting floats.
Since I think median passes parameters to sorted, it says it is also
solved for median (if you are willing to use that meaning for NaNs)
--
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/AUGSQRWKBL3HQTIJVKIBNB64O25A5RLF/
Code of Conduct: http://python.org/psf/codeofconduct/