My last post explained my frustration trying to get pyrex to do *anything*. Since then, several people posted solutions and e-mailed me with more ideas (thanks allefant and Filip Wasilewski). My review was focused on the usability of pyrex as a python->C translator, since that’s what I was working on with both shed-skin and pypy/rpython. It didn’t hold up so well. This is because … pyrex ISN’T a python->C translator.

pyrex is its own special language that contains both python and C stuff. pyrex does not do type inference. What pyrex provides is a way to mix both python and python-like C code together in the same files. The trick to understanding pyrex is to know where the line between python and C is in pyrex.

Here are some of the gotchas I experienced. I wasn’t able to detail them in my previous post because I didn’t really “get it”. Now I think I do, so I’ll explain some stuff so you can try out pyrex without getting confused the way I did:

All that said, I think pyrex is really neat for writing extensions!Â One of the best features it has is properties (which are like descriptors, only easier).Â Just be careful if you use it to not mistake it for python.Â Lastly, by using those tips I was able to get my julia example to be full speed.

This entry was posted
on Wednesday, December 5th, 2007 at 2:19 pm and is filed under development, languages, python.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.