Instant Py just add C code

One thing that makes Python so fast is that a great deal of the libraries are actually written in C and C++. One reason for this is that it's so easy to add a C program to Python, especially if you compare it to say, Java.
It's great, if there's a part of your Python program that's too slow, you can rewrite it in C++. I've done it with Boost.Python for a Python project for my wife and it worked great. There's also SWIG but it's a little more suitable for C programs instead of C++ and I've heard the implementation runs a little slower than Boost's. But it compiles a lot faster so the debug cycle is a little faster.
There a new method to do this in town (at least for Unix) it's called pyInstant. You put your C code in a string and when your Python program runs the Instant.create_extension() method it'll automatically make a make file, create the SWIG interface file, compile it and by the next line you can execute the compiled C code, doesn't get much easier than that.
(well actually Psyco is easier, and Pyrex maybe too)
Technorati Tags: ,

Technorati Tags: ,

Comments

Popular posts from this blog

Shortest Sudoku solver in Python

Seven Segment Display in Inkscape