[Numpy-discussion] Keywords in wrapped functions

Pierre GM pgmdevlist@gmail....
Sun Jun 8 13:35:09 CDT 2008


All,

is there a reason why in some functions (min, max...) optional parameters are 
parsed by position instead of by keyword ?
OK, let me give you an example:
#-----------------------------------------------
def amin(a, axis=None, out=None):
    try:
        amin = a.min
    except AttributeError:
        return _wrapit(a, 'min', axis, out)
    return amin(axis, out)
#-----------------------------------------------

* Why using amin(axis,out) instead of amin(axis=axis,out=out) ?

* Would it be possible to add some optional keywords to amin/amax, so that 
a "fill_value" parameter would be recognized by numpy.min when dealing with 
masked arrays ? A modified amin would then be like:

def amin(a, axis=None, out=None, **kwargs):
    try:
        amin = a.min
    except AttributeError:
        return _wrapit(a, 'min', axis=axis, out=out, **kwargs)
    return amin(axis=axis, out=out, **kwargs)

Am I missing something ?


More information about the Numpy-discussion mailing list