On Dec 29, 2019, at 21:00, David Mertz <me...@gnosis.cx> wrote: > > >> On Sun, Dec 29, 2019 at 11:33 PM Andrew Barnert <abarn...@yahoo.com> wrote: > >> IEEE total order specifies a distinct order for every distinct bit pattern, >> and tries to do so in a way that makes sense. > > Ok, ok... I've got "learned up" about this three times now :-). Given we > cannot control those bit patterns from Python, I'm a bit "meh"... but I get > the rule (yeah, yeah, struct module)
That’s either me or AT&T being slow; either way, apologies. >> The 95% case is handled by just ignore and raise. Novices should probably >> never be using anything else. >> Experts will definitely often want poison. And probably sometimes fast for >> backward compatibility and/or performance. That gets you to 98%. > > Fair enough. I really only care about the 98% case. But if you can convince > Steven to add `key=` as well, no real harm to me. My only concern is a > beginner who types `help(median)` and scratches her head over the key > oddness. But I guess the docstring can say "Don't worry about this if you > don't need a custom sort order for your objects." I’m more concerned that a beginner who types help(median) sees an on_nan that has five or more values that they don’t understand and, has no idea which one to choose. But I guess the same thing here: the docstring can tell them that they almost always want the default RAISE, or IGNORE if they’re using NaN to mean missing values, and then describe the other options. (It’s not like they have to be in alphabetical order…) And anyway, the real problem is, as always, beginners who copy-paste something off StackOverflow or a blog post without reading any help or even the text around the code, and then want to know “why this crash” when they explicitly passed a list full of nans with on_nan=RAISE. And, given that there are at least two frequently-useful behaviors, there has to be something that those people are going to misuse… > Do remember that using `sorted()` is an implementation detail, not a promise > of functions in statistics module. Sure, but conceptually median really is about order in a way that, e.g., mean and stdev are not. You’re asking for the middle value in sorted order, even if the fact that this happens to be done by actually sorting the values is an implementation detail you shouldn’t care about.
_______________________________________________ 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/NDS4X4VKR36FUIJV4TXAHC4IMU2BQV4D/ Code of Conduct: http://python.org/psf/codeofconduct/