[Numpy-discussion] ndarray methods vs numpy module functions
Mon Jun 23 18:10:26 CDT 2008
On Mon, Jun 23, 2008 at 10:31 AM, Bob Dowling <email@example.com> wrote:
> [ I'm new here and this has the feel of an FAQ but I couldn't find
> anything at http://www.scipy.org/FAQ . If I should have looked
> somewhere else a URL would be gratefully received. ]
> What's the reasoning behind functions like sum() and cumsum() being
> provided both as module functions (numpy.sum(data, axis=1)) and as
> object methods (data.sum(axis=1)) but other functions - and I stumbled
> over diff() - only being provided as module functions?
this is a very good question.
I think the answers are
a) historical reasons AND, more importantly, differing personal preferences
b) I would file the missing data.diff() as a bug. There are many
inconsistencies left in such a big project like numpy. And filing
bugs might be the best way of keeping track of them and getting them
(( a much more dangerous example is numpy.resize and data.resize,
which do (slightly) different things !!))
Others, please correct my .....
Welcome on the list.
More information about the Numpy-discussion