ANN: Pyrex - a language for writing Python extension modules
Skip Montanaro
skip at pobox.com
Thu Apr 4 16:50:55 EST 2002
Greg> Pyrex is more or less Python with C data types added. You can
Greg> write functions which freely intermix operations on Python and C
Greg> data, with all Python reference counting and error checking
Greg> completely automated.
Interesting, but why not simply attach the type information to function
attributes so the Pyrex code really is just Python? The Pyrex compiler can
fish the type information out of function attributes as readily as from the
program source code.
The advantages? I can think of a couple right off the bat:
You can defer Pyrex compilation until you realize you need it. Naively
compiling all your code to C makes for a lot of (object) code bloat and
doesn't necessarily speed anything up (if, for example, the code is I/O
bound or not executed frequently enough). This was one of the problems
with Python2C.
You could train PyChecker about the data type information, which it
could use to produce more (and more useful) warnings about suspect
Python usage.
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list