[Numpy-discussion] Keywords in wrapped functions

Pierre GM pgmdevlist@gmail....
Tue Jun 24 13:03:19 CDT 2008


All,
Sorry to bumpt the post, accept my apologies for my rudeness, but I'm 
curious...
So, let me rephrase my question:

Many numpy functions (min, max, sum...) based on ndarray methods have a 
construction of the style
#-----------------------------------------------
def amin(a, axis=None, out=None):
    try:
        amin = a.min
    except AttributeError:
        return _wrapit(a, 'min', axis, out)
    return amin(axis, out)
#-----------------------------------------------

I'm wondering why the initial keywords arguments are transformed into 
positional arguments in the return. In the previous example, I would expect a 
line like
return amin(axis=axis, out=out)

[Actually, I would even prefer a 
return amin(axis=axis, out=out, **other_optional_parameters), which would 
permit to add some extra parameters such as a "fill_value", when dealing with 
masked arrays ?]

Is this for efficiency purposes ?






More information about the Numpy-discussion mailing list