Generators in C code

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue May 15 00:55:59 EDT 2007


Hi

I'd like to write a generator in C, callable from Python.
The only way to create a generator object I can see, is using  
PyGen_New(frame) - and a frame object implies Python code, right? holding  
global state and local variables and stack and a lot of stuff, so perhaps  
there is no (easy) way I could write that in C code.
Or perhaps some way to execute a yield statement inside a C function?  
Being able to resume execution at the same point later?
I feel I'm out of luck, but if someone could point some way to write a  
generator in C, I'be very grateful!

-- 
Gabriel Genellina




More information about the Python-list mailing list