[Numpy-discussion] Counting array elements
Russell E Owen
rowen at u.washington.edu
Fri Oct 22 11:20:36 EDT 2004
At 11:02 AM -0700 2004-10-22, Chris Barker wrote:
>Stephen Walton wrote:
>
>> There is a difference between the sum() Ufunc and the sum() method which
>> is not mentioned in the documentation: the function works along an
>> axis, while the method works on the whole array. That is, A.sum() and
>> A.flat.sum() are equivalent regardless of the rank of A.
>
>
>Bummer. I was hoping this was a move to a more object-oriented
>style, rather than different functionality. Also, it's pretty
>confusing terminology, particularly if it's not documented! Why not
>.SumAll() or something?
I agree. Numarray is already confusing enough without identically
named functions and methods that do different things. (nElements and
size are another pet peeve, with size used in several places and
nElements appearing exactly once. Though I am grateful to whoever
added size as a workalike for nElements; formerly you had to know
what kind of array you had before you knew how to find out how many
elements it had.)
-- Russell
More information about the NumPy-Discussion
mailing list