[Numpy-discussion] What is consensus anyway

Nathaniel Smith njs at pobox.com
Tue Apr 24 15:02:46 EDT 2012


On Tue, Apr 24, 2012 at 2:43 PM, Pierre Haessig
<pierre.haessig at crans.org> wrote:
> If the idea of having two payloads is to avoid a maximum of "skipna &
> friends" extra keywords, I would like it much. My feeling with my small
> experience with R is that I end up calling every function with a
> different magical set of keywords (na.rm, na.action, ... and I forgot).

While I can't in general defend R on consistency grounds, there is a
logic to this particular case.

Most basic R functions like 'sum' take the na.rm= argument, which can
be True or False and is equivalent to the skipna argument we've talked
about for ufuncs. The functions that take other arguments (like
na.action= for model fitting functions, or use= for their equivalent
of np.corrcoef) are the ones that have *more* than 2 ways to handle
NAs. E.g. model fitting functions given NAs can raise an error, skip
the NA cases, or pass the NA cases through, and the correlation matrix
function has different options for what to do with cases where one
column has an NA but there are two others that don't.

Having a distinction between missing and ignored values doesn't really
affect whether you need such options. (If anything I guess it could
make such options even more complicated -- what if I want my
regression function to error out on missing but skip over ignored
values, etc.)

- N



More information about the NumPy-Discussion mailing list