None versus MISSING sentinel -- request for design feedback

Teemu Likonen tlikonen at iki.fi
Fri Jul 15 04:28:43 EDT 2011


* 2011-07-15T15:28:41+10:00 * Steven D'Aprano wrote:

> I'm designing an API for some lightweight calculator-like statistics
> functions, such as mean, standard deviation, etc., and I want to
> support missing values. Missing values should be just ignored. E.g.:
>
> mean([1, 2, MISSING, 3]) => 6/3 = 2 rather than 6/4 or raising an
> error.
>
> My question is, should I accept None as the missing value, or a
> dedicated singleton?

How about accepting anything but ignoring all non-numbers?



More information about the Python-list mailing list