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

Pierre Haessig pierre.haessig@crans....
Tue Feb 26 02:35:06 CST 2013


Hi,

Le 23/02/2013 20:25, Nathaniel Smith a écrit :
> My gut feeling is that we have too many methods on ndarray, not too
> few, but in any case, can you elaborate? What's the rationale for why
> np.abs(a) is so much harder than a.abs(), and why this function and
> not other unary functions?
(Just another usecase where I see the x.abs() notation useful)

If x is a complex array, I feel that x.abs() and x.angle() would be
natural complements to x.real and x.imag.

Of course, x.angle() only make much sense for complex arrays while
x.abs() makes sense for any numerical array.

best,
Pierre

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130226/ccd6b2c2/attachment.bin 


More information about the NumPy-Discussion mailing list