[Numpy-discussion] Exporting Numpy C functionality to other extension modules

Chris Barker Chris.Barker at noaa.gov
Thu Jan 16 10:33:07 EST 2003


Jack Jansen wrote:

> An extension module that knows about this protocol and gets passed an
> object that it think might be a Numeric array checks whether the object
> has an __Numeric_C_interface attribute. If so it retrieves it, checks
> that it is a Cobject, gets the descriptor and tests it for
> compatibility and if it is compatible gets the cobject pointer and
> happily calls all the Numeric routines it needs.

Wow Jack! are single handely going to impliment all my pet projects that
I'm too stupid to know how to do my self ? (the other one was Universal
text file support)

I can only barely follow what you're suggesting, but I still have a
question about it. It seems while this would provide a way ro an
extension module to identify whether an object was a Numeric array, and
then get a pointer to it, how would it know the API for dealing with the
arrays, without the Numeric header file? Or would you have to include
the header file when compiling, but not need the library at runtime
unless it was actually used, which seems a reasonable compromise.

If this would work, I think it's a great idea. Short of including
NumArray with the standard library (which I imagine is a least a couple
of Python releases away), it would be a great solution for folks that
are writing extensions that they want to be able take advantage of
Numeric when it's there, but not require it.

Do any of the primary Numarray developers think this is a good and
doable idea?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer
                                    		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the NumPy-Discussion mailing list