[Numpy-discussion] ndarray __getattr__ to perform __getitem__
Zachary Pincus
zachary.pincus at yale.edu
Fri Oct 29 09:32:30 EDT 2010
>>> But wouldn't the performance hit only come when I use it in this
>>> way?
>>> __getattr__ is only called if the named attribute is *not* found (I
>>> guess it falls off the end of the case statement, or is the result
>>> of
>>> the attribute hash table "miss").
>> That's why I said that __getattr__ would perhaps work better.
>
>
> So do you want me to try out an implementation and supply a patch? If
> so, where should I send the patch?
>
> Ian
Note that there are various extant projects that I think attempt to
provide similar functionality to what you're wanting (unless I badly
misread your original email, in which case apologies):
http://projects.scipy.org/numpy/wiki/NdarrayWithNamedAxes
You might want to check these out (or pitch in with those efforts)
before starting up your own variant. (Though if your idea has more
modest goals, then it might be a good complement to these more
extensive/intrusive solutions.)
Zach
More information about the NumPy-Discussion
mailing list