[SciPy-dev] Idle (?) speculation about ndarray [was draft: NumPy User Guide introduction]

David Goldsmith d_l_goldsmith at yahoo.com
Fri Aug 21 11:30:20 EDT 2009


I wasn't thinking to replace ndarray w/ Stefan's idea; rather, I was thinking of the possibility of deriving ndarray from Stefan's idea, implemented as _ndarray (i.e., it'd be "private" so as to not disrupt the API and, hopefully, not confuse people too much).  But if there would be performance _loss_ in doing so...never mind. :-)

DG

--- On Fri, 8/21/09, josef.pktd at gmail.com <josef.pktd at gmail.com> wrote:

> From: josef.pktd at gmail.com <josef.pktd at gmail.com>
> Subject: Re: [SciPy-dev] Idle (?) speculation about ndarray [was draft: NumPy User Guide introduction]
> To: "SciPy Developers List" <scipy-dev at scipy.org>
> Date: Friday, August 21, 2009, 8:07 AM
> On Fri, Aug 21, 2009 at 10:52 AM,
> David
> Goldsmith<d_l_goldsmith at yahoo.com>
> wrote:
> > --- On Thu, 8/20/09, Stéfan van der Walt <stefan at sun.ac.za>
> 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,
> >> and
> >> 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.
> 
> eg. np.source(np.mean)
> 
>     try:
>         mean = a.mean
>     except AttributeError:
>         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)
> 
> Josef
> 
> > DG
> >
> >
> >
> > _______________________________________________
> > Scipy-dev mailing list
> > Scipy-dev at scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-dev
> >
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
> 


      



More information about the SciPy-Dev mailing list