Superclass initialization

Aahz aahz at pythoncraft.com
Fri Apr 24 18:47:15 EDT 2009


In article <ytz8wlqgncf.fsf at burgos.aip.de>,
Ole Streicher  <ole-usenet-10 at gmx.net> wrote:
>
>I am trying to initialize a class inherited from numpy.ndarray:
>
>from numpy import ndarray
>
>class da(ndarray):
>    def __init__(self, mydata):
>        ndarray.__init__(self, 0)
>        self.mydata = mydata
>
>When I now call the constructor of da:
>da(range(100))
>
>I get the message:
>
>ValueError: sequence too large; must be smaller than 32
>
>which I do not understand. This message is generated by the constructor
>of ndarray, but the ndarray constructor (ndarray.__init__()) has only
>"0" as argument, and calling "ndarray(0)" directly works perfect.

Did you read the docs?  According to
http://docs.scipy.org/numpy/docs/numpy.ndarray/#numpy-ndarray
the first argument to an ndarray constructor is the shape, and I suppose
arrays might be limited to 32 dimensions.  Anyway, I suggest that you
subscribe to one of the NumPy mailing lists and ask there:
http://scipy.org/Mailing_Lists
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list