[Numpy-discussion] Adding .abs() method to the array object
Tue Feb 26 04:50:20 CST 2013
On Tue, Feb 26, 2013 at 12:11 AM, Charles R Harris
> On Sat, Feb 23, 2013 at 1:33 PM, Robert Kern <firstname.lastname@example.org> wrote:
>> On Sat, Feb 23, 2013 at 7:25 PM, Nathaniel Smith <email@example.com> wrote:
>> > On Sat, Feb 23, 2013 at 3:38 PM, Till Stensitzki <firstname.lastname@example.org>
>> > wrote:
>> >> Hello,
>> >> i know that the array object is already crowded, but i would like
>> >> to see the abs method added, especially doing work on the console.
>> >> Considering that many much less used functions are also implemented
>> >> as a method, i don't think adding one more would be problematic.
>> > 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?
>> Or even abs(a).
> Well, that just calls a method:
> In : ones(3).__abs__()
> Out: array([ 1., 1., 1.])
> Which shows the advantage of methods, they provide universal function hooks.
I'm not sure what point you are trying to make. It does not appear to
be relevant to adding an ndarray.abs() method.
More information about the NumPy-Discussion