[Numpy-discussion] Median advice

Joris De Ridder Joris.DeRidder@ster.kuleuven...
Tue Feb 12 06:33:36 CST 2008


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.

Just my 0.02 euros.

Joris




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the Numpy-discussion mailing list