From: David M. C. <co...@ph...> - 2006-08-23 21:13:50
|
On Wed, 23 Aug 2006 13:51:02 -0700 Sebastian Haase <ha...@ms...> wrote: > Hi! > numpy renamed the *function* abs to absolute. > Most functions like mean, min, max, average, ... > have an equivalent array *method*. > > Why is absolute left out ? > I think it should be added . We've got __abs__ :-) > Furthermore, looking at some line of code that have multiple calls to > absolute [ like f(absolute(a), absolute(b), absolute(c)) ] > I think "some people" might prefer less typing and less reading, > like f( a.abs(), b.abs(), c.abs() ). > One could even consider not requiring the "function call" parenthesis '()' > at all - but I don't know about further implications that might have. eh, no. things that return new arrays should be functions. (As opposed to views of existing arrays, like a.T) > PS: is there any performace hit in using the built-in abs function ? Shouldn't be: abs(x) looks for the x.__abs__() method (which arrays have). -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |co...@ph... |