[Pyrex] Subclassing Numeric arrays
len-l at telus.net
len-l at telus.net
Mon May 9 23:41:49 CEST 2005
On 9 May 2005 at 8:33, Joachim Saul wrote:
> * George Sakkis [2005-05-08 21:00]:
> > cdef class MyVector(ArrayType):
> > pass
> >
> > # seg fauls
> > v = Vector((1,2))
> >
> > Can anyone show the simplest working subclass of PyArrayObject ?
>
> To the best of my knowledge you can't subclass Numeric arrays in
> Python and as Greg said, if not in Python you can't do so in Pyrex
> either. This has been a subject of intense discussion amongst the
> developers and users of Numeric, and apart from some "historical"
> reasons there are some good technical reasons *not* to support
> subclassing of Numeric arrays.
>
This is just an aside, but a numarray array can be subclassed:
Python 2.3.3 (#51, Jan 27 2004, 16:30:16) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numarray
>>> class MyArray(numarray.ArrayType): pass
...
>>>
Lenard Lindstrom
<len-l at telus.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20050509/ac777a38/attachment.html
More information about the Pyrex
mailing list