|
|
Subject: Re: Subclassing numpy.ndarray with Pyrex - msg#00020
List: python.pyrex
On Tuesday 06 February 2007 17:46:42 Greg Ewing wrote:
> Lenard Lindstrom wrote:
...
> > As for the segment faults even stripping away everything but the class
> > declaration doesn't stop them.
>
> I don't have time to look into this deeply now, but if
> anyone can investigate and find out whether this is
> because of something Pyrex is doing wrong or something
> Numpy is doing wrong, that would be helpful.
I'd be more than happy to. However, I'd welcome some pointers about debugging
resources...
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: More on enums in 0.9.5.1a
Eric Huss wrote:
> i = e + 1 # Fails.
Hmmm, it seems you're right, C++ allows this without
warning, although it doesn't seem very useful. It
would be more useful IMO to allow
e = e + 1
but that isn't allowed because the result is of type
int instead of enum.
I'll see about fixing this.
--
Greg
Next Message by Date:
click to view message preview
Re: Default class attributes
Pierre GM wrote:
> I guess that if I really need a class
> attribute, I can always wrap it in a property.
If you just want an attribute shared between
instances, that will work. It won't be quite like
a true class attribute, though, because it won't
be accessible via the class.
--
Greg
Previous Message by Thread:
click to view message preview
Re: Subclassing numpy.ndarray with Pyrex
Lenard Lindstrom wrote:
> I don't think numpy was well tested with Pyrex. The provided
> c_numpy.pxd causes a pyrex compiler error involving an array of objects.
> As for the segment faults even stripping away everything but the class
> declaration doesn't stop them.
I don't have time to look into this deeply now, but if
anyone can investigate and find out whether this is
because of something Pyrex is doing wrong or something
Numpy is doing wrong, that would be helpful.
--
Greg
Next Message by Thread:
click to view message preview
Re: Subclassing numpy.ndarray with Pyrex
> Urk, this doesn't bode well for being able to subclass
> ndarray in Pyrex. If the normal instance creation
> mechanisms are bypassed, various things that Pyrex
> relies on won't happen, such as initialisation of
> Python-valued attributes.
Indeed. Well, thanks anyway
> Do you really need to subclass ndarray? Could you
> get what you want using a different class that
> wraps an ndarray instead?
Oh, I tried creating objects in Pyrex that use ndarrays as attributes, and
that works pretty well indeed. However, numpy does not recognize them as
arrays. Functions using the numpy.asanyarray trick would transform them in
basic ndarrays, thus ripping off any specific attributes.
The more it goes, the less comfortable I am with direct subclassing of
ndarrays anyway...
|
|