[SciPy-dev] Idle (?) speculation about ndarray [was draft: NumPy User Guide introduction]
Fri Aug 21 10:07:12 CDT 2009
On Fri, Aug 21, 2009 at 10:52 AM, David
> --- On Thu, 8/20/09, Stéfan van der Walt <firstname.lastname@example.org> wrote:
>> I like the idea of an ndarray being a concise description
>> of bytes in
>> memory. At the moment, we have a couple of "special"
>> methods attached
>> to it, but we could just as well have added fewer or more,
>> personally I'd have preferred none.
> Interesting, I see the appeal from an aesthetics stand point - I don't know enough about such things as: do you think it would have performance implications? If so, could this be tested by instantiating an ndarray and then assigning None to all of it's attributes (or would you shed only the public methods but not the data attributes, properties, and private accessors on which they rely)? Just speculating idly at this point.
Methods are useful for being overwritten by subclasses. And the last
time I checked method calls were a bit faster than functions.
mean = a.mean
return _wrapit(a, 'mean', axis, dtype, out)
return mean(axis, dtype, out)
And, I like methods because they look very good in chaining
(especially with no trailing arguments like in german sentences)
I'm missing absolute value as a method.
mae = (x - a).abs().mean(0) instead of mae = np.mean(np.abs(x - a), 0)
> Scipy-dev mailing list
More information about the Scipy-dev