[Numpy-discussion] Misc Pyrex questions

Pierre GM pgmdevlist at gmail.com
Mon Jan 22 10:07:22 EST 2007

Dear All,
I started playing with Pyrex this week-end, to see how easy it would be to 
port some subclasses to C. A good thing is that it's not as bad as I was 
dreading. I do have a lot of question, however:

- Can I create a subclass w/ Pyrex ? If yes, how ? I haven't been able to find 
any example in the numerous tutorials I browsed through, and my naive attempt 
cdef NewSubclass(ndarray)
didn't work at all.

-  I want to create an output ndarray from a given an input sequence/ndarray.
 I'm using PyArray_FROM_OTF, which asks me for a dtype. How can I guess the 
dtype of the input sequence ? In Python, a numpy.asarray(obj) would do the 
trick, the dtype would be set to the maximum possible.

- What'd be a more pyrex-esque way to code the resize and reshape functions ?

- Is there a standard way to deal w/ __getitem__ ? especially when the item is 
not an integer (but a slice or a sequence) ?

Thanks a lot in advance for your help.
PS: Sorry for the cross-posting

More information about the NumPy-Discussion mailing list