[SciPy-dev] draft: NumPy User Guide introduction
Dag Sverre Seljebotn
Tue Aug 25 03:56:30 CDT 2009
Lisandro Dalcin wrote:
> On Sun, Aug 23, 2009 at 2:02 AM, Charles R
> Harris<firstname.lastname@example.org> wrote:
>> but for
>> maintainence and development I think that functions make it easier to add
>> functionality without bloating the ndarray object.
> Why do you say that adding methods bloat the ndarray object? Adding
> functions bloats the numpy namespace,
> adding methods bloat the numpy.ndarray namespace... In both cases you
> are just populating a dict... What's the difference for you?
I guess it is not directly related to "bloat", but:
- Functions are closer to common mathematical notation
- (As others have said,) functions will in the future work on any PEP
3118 buffer, while methods need an ndarray object.
>> And figuring out what
>> all the desireable methods are up front is a difficult exercise in
>> prospective design.
> I think you are going to be faced to such difficulties when deciding
> desirable functions for the numpy namespace.
I disagree. It is quite straightforward that np.sin, np.mean and np.dot
all are rightly included in the namespace -- however, why exactly is it that
is OK, while arr.sin(), arr.cos() or arr.dot(otherarr) is not?
(It seems the rule is "array -> scalar" mappings are OK as method,
others are not, but that seems arbitrary to me.)
More information about the Scipy-dev