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

David Goldsmith d_l_goldsmith@yahoo....
Fri Aug 21 10:30:20 CDT 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@gmail.com <josef.pktd@gmail.com> wrote:

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


      


More information about the Scipy-dev mailing list