[Numpy-discussion] Median advice
Tue Feb 12 12:54:47 CST 2008
On Feb 12, 2008 6:33 AM, Joris De Ridder
> On 12 Feb 2008, at 12:31, Matthew Brett wrote:
> > def median(a, axis=0, out=None)
> > (same signature as max, min etc)
> I would be slightly in favour of this option.
> Using the same signature would be convenient in code like
> def myfunc(myarray, somefunc):
> # do stuff
> x = somefunc(myarray, axis = 0, out = None)
> # do more stuff
> where somefunc could be median(), mean(), max(), min(), std() etc. I
> once wrote this kind of function to provide (small) image filtering.
> If the same signature is used, there is no need to special-case
> median(). I realise it's kind of a niche example, though.
I'm happy with that use case. The docstring should mention that out=
is not memory-optimized like it is for the others, though.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion