On Mon, May 14, 2012 at 3:23 AM, Mark Lawrence <breamore...@yahoo.co.uk> wrote: > On 13/05/2012 16:39, Chris Angelico wrote: >> >> On Sun, May 13, 2012 at 11:25 PM, David Shi<davidg...@yahoo.co.uk> wrote: >>> >>> Can anyone tell me how to call and exectute C code in Python? >> >> >> Browse the documentation about Extending and Embedding Python, there's >> an extensive API. >> >> Chris Angelico > > I like your response, my first thought was to say "yes" :)
Hehe. Never ask a geek a yes-no question, eh. Regarding Cython vs direct use of the API: I cannot in good faith recommend Cython, as I've never used it, but it very likely could be the right option. However, my answer to a vague and nonspecific question would still have been a simple pointer to documentation, whether to Cython's or to the underlying API. To the OP: Be more specific about what you're trying to do, and you'll likely get more helpful answers. :) Incidentally, one of the easiest ways to deal with refcounting imho is to write a thin C++ layer around the PyObject* for locally owned references. Of course, that works only if you're writing C++ code, but it did save me a lot of hassle when I was embedding Python in C++. ChrisA -- http://mail.python.org/mailman/listinfo/python-list