3 ms·
Scripting C with Python
- mcav 17y agoIt'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.
- cracki 17y agodated. 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.
- silentbicycle 17y agoIf 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).
- jcromartie 17y agoIndeed. Lua also offers a tremendously flexible method of setting up sandboxes or restricted/unusual function environments.