[Numpy-discussion] __array_wrap__

Darren Dale dsdale24 at gmail.com
Wed Sep 30 07:30:30 EDT 2009


On Wed, Sep 30, 2009 at 2:57 AM, Pauli Virtanen <pav+sp at iki.fi> wrote:
> Tue, 29 Sep 2009 14:55:44 -0400, Neal Becker wrote:
>
>> This seems to work now, but I'm wondering if Charles is correct, that
>> inheritance isn't such a great idea here.
>>
>> The advantage of inheritance is I don't have to implement forwarding all
>> the functions, a pretty big advantage. (I wonder if there is some way to
>> do some of these as a generic 'mixin'?)
>
> The usual approach is to use __getattr__, to forward many routines with
> little extra work.

... with a side effect of making the API opaque and breaking tab
completion in ipython.

Darren



More information about the NumPy-Discussion mailing list