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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/ZCPC2NAINJHQPJMNYNYHYBOCOC4IV5PQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to