[Numpy-discussion] request for new array method: arr.abs()

David M. Cooke cookedm at physics.mcmaster.ca
Wed Aug 23 18:40:48 CDT 2006

On Wed, 23 Aug 2006 16:22:52 -0700
Sebastian Haase <haase at msg.ucsf.edu> wrote:

> On Wednesday 23 August 2006 16:12, Bill Baxter wrote:
> > The thing that I find I keep forgetting is that abs() is a built-in, but
> > other simple functions are not.  So it's abs(foo), but numpy.floor(foo)
> > and numpy.ceil(foo).  And then there's round() which is a built-in but
> > can't be used with arrays, so numpy.round_(foo).    Seems like it would
> > be more consistent to just add a numpy.abs() and numpy.round().
> >
> Regarding the original subject: 
> a) "absolute" is impractically too much typing and 
> b) I just thought some (module-) functions might be "forgotten" to be put
> in as (object-) methods ... !?

Four-line change, so I added a.abs() (three lines for array, one
for MaskedArray).

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the Numpy-discussion mailing list