[Numpy-discussion] Adding .abs() method to the array object

Skipper Seabold jsseabold@gmail....
Mon Feb 25 09:50:59 CST 2013

On Mon, Feb 25, 2013 at 10:43 AM, Till Stensitzki <mail.till@gmx.de> wrote:
> 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
> 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
> especially for most of the commonly used functions (min, max, dot, mean,
> argmin, argmax, conj, T) makes me missing abs. Of course, if one would
> 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".

I tend to agree here. The situation isn't all that dire for the number of
methods in an array. No scrolling at reasonably small terminal sizes.

[3]: x.
x.T             x.copy          x.getfield      x.put           x.std
x.all           x.ctypes        x.imag          x.ravel         x.strides
x.any           x.cumprod       x.item          x.real          x.sum
x.argmax        x.cumsum        x.itemset       x.repeat        x.swapaxes
x.argmin        x.data          x.itemsize      x.reshape       x.take
x.argsort       x.diagonal      x.max           x.resize        x.tofile
x.astype        x.dot           x.mean          x.round         x.tolist
x.base          x.dtype         x.min           x.searchsorted  x.tostring
x.byteswap      x.dump          x.nbytes        x.setfield      x.trace
x.choose        x.dumps         x.ndim          x.setflags      x.transpose
x.clip          x.fill          x.newbyteorder  x.shape         x.var
x.compress      x.flags         x.nonzero       x.size          x.view
x.conj          x.flat          x.prod          x.sort
x.conjugate     x.flatten       x.ptp           x.squeeze

I find myself typing things like




quite often.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130225/6987e608/attachment.html 

More information about the NumPy-Discussion mailing list