On Sun, Dec 29, 2019 at 06:23:03PM -0800, Andrew Barnert via Python-ideas wrote:
> Likewise, it’s even easier to write ignore-nan yourself than to write the DSU > yourself: > > median = statistics.median(x for x in xs if not x.isnan()) Try that with xs = [1, 10**400, 2] and come back to me. > So, why isn’t adding a key parameter (as well as an on_nan that takes > fast/ignore/raise/poison) to median useful? That's the wrong question. The right question is, why is adding a key parameter useful? The statistics module is for calculating statistics. Think of it as like a button on your scientific calculator in STATS mode. It's not designed for tasks like finding the employee with the median salary or the highest performing sales representative for the third quarter of 2017. If you want SQL, you know how to get it :-) -- Steven _______________________________________________ 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/ZCPC2NAINJHQPJMNYNYHYBOCOC4IV5PQ/ Code of Conduct: http://python.org/psf/codeofconduct/