[Numpy-discussion] ndarray methods vs numpy module functions

Ryan May rmay31 at gmail.com
Mon Jun 23 20:35:35 EDT 2008


Robert Kern wrote:
> On Mon, Jun 23, 2008 at 18:10, Sebastian Haase <haase at msg.ucsf.edu> wrote:
>> On Mon, Jun 23, 2008 at 10:31 AM, Bob Dowling <rjd4 at cam.ac.uk> 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?
>>>
>>>
>> Hi Bob,
>> 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.
> 
> It's not.
> 
Care to elaborate?

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma



More information about the NumPy-Discussion mailing list