[Numpy-discussion] Using new numeric instances in NumArray and RecArray.

Todd Miller jmiller at stsci.edu
Mon Dec 13 08:49:03 CST 2004


On Mon, 2004-12-13 at 11:23, Ivan Vilata i Balaguer wrote:

>   I'm trying to define new types that can be handled as normal types in
>   numarray, but being different (distinguishable) from their equivalent
>   types.  For instance, an array of MyInt32 should work exactly as an
>   Int32 array, but I would need to know it is a MyInt32 array and not an
>   Int32 one.
> 
>       However, I you believe that the system is not prepared for that
>   (or it would require too much work) I will try to identify it by some
>   external means.  Thank you anyway for your prompt answer.

I think the system is simply not designed for that.  For what you want, 
I think Int32 would need to be a class, not an instance, so that it
could be subclassed while retaining a relatively simple C
implementation.  As you noted,  the C infrastructure works using a type
mapping table which maps type *instances* onto type numbers, so it won't
work as it is now.  

Regards,
Todd





More information about the Numpy-discussion mailing list