Fri, 29 Oct 2010 09:58:33 -0400, Ian Stokes-Rees wrote:
[clip]
> I've spent an hour looking at the numpy code (my first time), and I
> don't see any obvious way to do this, since ndarray is (AFAICT) a pure-C
> object with auto-generated wrappers, which seems to preclude (easily)
> adding a "__getat
On Oct 29, 2010, at 3:58 PM, Ian Stokes-Rees wrote:
>
>> 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/wi
> 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
Having looked into it more, I think
>>> 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 __g
Hi,
Fri, 29 Oct 2010 05:59:07 -0400, Ian Stokes-Rees wrote:
>>> 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
>> 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 p
On Thu, Oct 28, 2010 at 16:37, Ian Stokes-Rees
wrote:
>
>
> On 10/28/10 5:29 PM, Robert Kern wrote:
>> On Thu, Oct 28, 2010 at 15:17, Ian Stokes-Rees
>> wrote:
>>> I have an ndarray with named dimensions. I find myself writing some
>>> fairly laborious code with lots of square brackets and quote
On 10/28/10 5:29 PM, Robert Kern wrote:
> On Thu, Oct 28, 2010 at 15:17, Ian Stokes-Rees
> wrote:
>> I have an ndarray with named dimensions. I find myself writing some
>> fairly laborious code with lots of square brackets and quotes. It seems
>> like it wouldn't be such a big deal to overload
On Thu, Oct 28, 2010 at 15:17, Ian Stokes-Rees
wrote:
> I have an ndarray with named dimensions. I find myself writing some
> fairly laborious code with lots of square brackets and quotes. It seems
> like it wouldn't be such a big deal to overload __getattribute__ so
> instead of doing:
>
> r =