[Numpy-discussion] Multiple inheritance from ndarray

Robert Lupton rhl at astro.princeton.edu
Sun Feb 19 18:14:01 CST 2006

I have a swig extension that defines a class that inherits from
both a personal C-coded image struct (actImage), and also from
Numeric's UserArray.  This works very nicely, but I thought that
it was about time to upgrade to numpy.

The code looks like:

from UserArray import *

class Image(UserArray, actImage):
     def __init__(self, *args):
         actImage.__init__(self, *args)
         UserArray.__init__(self, self.getArray(), 'd', copy=False,  

I can't figure out how to convert this to use ndarray, as ndarray  
seem to have an __init__ method, merely a __new__.

So what's the approved numpy way to handle multiple inheritance?   
I've a nasty
idea that this is a python question that I should know the answer to,  
but I'm
afraid that I don't...


More information about the Numpy-discussion mailing list