[Numpy-discussion] ndarray methods vs numpy module functions

Robert Kern robert.kern at gmail.com
Mon Jun 23 19:14:01 EDT 2008


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.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the NumPy-Discussion mailing list