Hacker News new | past | comments | ask | show | jobs | submit login
Scripting C with Python (suttoncourtenay.org.uk)
14 points by kungfudoi on July 19, 2009 | hide | past | favorite | 4 comments



If you're trying to script a C application, Lua is also worth a look. It's similar to Python (with more Scheme influence: coroutines, real lambdas, fully lexical scoping, no GIL), but its design favors being small and easy to embed over "batteries included" (since if you're scripting a C project, you probably already have the libraries you need).


Indeed. Lua also offers a tremendously flexible method of setting up sandboxes or restricted/unusual function environments.


It's really easy to use CTypes, with DLLs exporting regular C functions (as described in the article). That's a very straightforward way to get some quick Python-to-C when you need it.


dated.

also, now there's cython, which is a more advanced variation of pyrex.

edit: okay, that link was useless. sorry for that.

cython and pyrex are trying to be mostly source-compatible, but cython often includes features faster.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: