[Numpy-discussion] Thoughts for 1.1

Timothy Hochberg tim.hochberg@ieee....
Wed Apr 2 18:10:40 CDT 2008


[SNIP]

The text is getting kind of broken up so I'm chopping it and starting from
scratch.

To the question of whether it's a good idea to change the default behavior
of mean and friends to not reduce over the chosen axis, I have to agree with
Robert: too much code breakage for to little gain, so I'd give it a -1 as
well.

As to it's general usefulness, I'm torn. I've definitely run into situations
where I've had to add an axis that has been reduced away. On the other hand,
if the default behavior was reversed one might well end up with a comparable
number of cases where you had to manually reduce the result. And I don't
think that the squeeze result will work in general, since when working with
arrays of higher dimensions you sometimes want to keep a specific dimension
of length-1 so everything broadcasts correctly. That's admittedly fairly
rare though.

As to what to name it, if it did come to pass. I'm not happy 'keepshape'
since we'd not actually be keeping the shape, just the number of dimensions.
'keepdims' is better, but still seem awkard. I'd prefer something like
'reduce', so the signature would be a:
     mean(axis=None, dtype=None, out=None, reduce=True).

-- 
. __
. |-\
.
. tim.hochberg@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080402/ddd1c4ac/attachment.html 


More information about the Numpy-discussion mailing list