Settings

Theme

PythoC: A new way to generate C code from Python

infoworld.com

4 points by pm2222 3 days ago · 1 comment

Reader

zahlman a day ago

> PythoC doesn’t yet have a mechanism for re-using compiled code when it’s called from Python, the way Cython does.

> At first this seems like a pretty big limitation. But it’s actually the point: You can use PythoC as a code generation system for C programs that run independently, rather than C modules imported into Python.

I have a feeling this model isn't going to be very popular, and they'd be much better off with a way to reuse the compilation result.

> One possibility is that it could integrate more closely with Python at runtime. For instance, a @cached decorator could compile modules once, ahead of time, and then re-use the compiled modules when they’re called from within Python, instead of being recompiled at each run.

Yeah, pretty much what I was thinking. The @compile-decorated function is usable from Python, so the necessary binding logic is already implemented; so surely the decorator could just check a cache to see if the compiled equivalent is already available.

It seems like a powerful and flexible idea overall, though. The toy examples are probably not doing a great job of showcasing what's possible this way.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection