[Numpy-discussion] Adding .abs() method to the array object
Till Stensitzki
mail.till at gmx.de
Mon Feb 25 10:43:09 EST 2013
First, sorry that i didnt search for an old thread, but because i disagree with
conclusion i would at least address my reason:
> I don't like
> np.abs(arr).max()
> because I have to concentrate to much on the braces, especially if arr
> is a calculation
This exactly, adding an abs into an old expression is always a little annoyance
due to the parenthesis. The argument that np.abs() also works is true for
(almost?) every other method. The fact that so many methods already exists,
especially for most of the commonly used functions (min, max, dot, mean, std,
argmin, argmax, conj, T) makes me missing abs. Of course, if one would redesign
the api, one would drop most methods (i am looking at you ptp and byteswap). But
the objected is already cluttered and adding abs is imo logical application of
"practicality beats purity".
greetings
Till
More information about the NumPy-Discussion
mailing list