David, not exactly what you describe but might be close enough: Using C/C++ inline in Python: http://www.scipy.org/documentation/weave/weaveusersguide.html and they link to http://pyinline.sourceforge.net/ which I have not used so far. Ingo