[Python-ideas] NAN handling in the statistics module

Nathaniel Smith njs at pobox.com
Mon Jan 7 02:31:30 EST 2019


On Sun, Jan 6, 2019 at 11:06 PM Steven D'Aprano <steve at pearwood.info> wrote:
> I'm not wedded to the idea that the default ought to be the current
> behaviour. If there is a strong argument for one of the others, I'm
> listening.

"Errors should never pass silently"? Silently returning nonsensical
results is hard to defend as a default behavior IMO :-)

> How would you answer those who say that the right behaviour is not to
> propogate unwanted NANs, but to fail fast and raise an exception?

Both seem defensible a priori, but every other mathematical operation
in Python propagates NaNs instead of raising an exception. Is there
something unusual about median that would justify giving it unusual
behavior?

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-ideas mailing list