Pyrex and weave.accelerate

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Apr 10 02:16:47 EDT 2002


Patrick Miller wrote:
> 
> It appears that the premise of Pyrex (assumption warning!
> I'm not reading Greg's mind!) is that C types have
> Python equivalents expressible through the API
> (e.g. short/int/long are expressible through
> the PyInt_AsLong and PyInt_FromLong methods).

Something like that. There are certain basic types
(int, float, char *) for which the correspondence
is obvious, and Pyrex handles them automatically.
For the rest, Pyrex makes it easy for you to write
your own code to handle them however you see fit.

> Weave.accelerate allows programmers to teach weave
> the API for a type and then have it build the
> extension module from that knowledge.

One day Pyrex may know more about some of the
builtin Python objects, so you can do things like
getting at the contents of an array.array directly.
I'm hoping this will fall out naturally once
extension types can be defined, by treating these
objects as sort of "extern extension types".

> Now, I get full fallback to Python (in case weave fails to compile)

Failing to compile isn't really an issue with
Pyrex. If your Pyrex module fails to compile,
you fix it so it does compile. :-)

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list