[Numpy-discussion] __array_wrap__

Pauli Virtanen pav+sp at iki.fi
Wed Sep 30 02:57:08 EDT 2009


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.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list