Generators in C code
Raymond Hettinger
python at rcn.com
Tue May 15 01:12:40 EDT 2007
On May 14, 9:55 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> I feel I'm out of luck, but if someone could point some way to write a
> generator in C, I'be very grateful!
Perhaps the code in the itertools module will provide a good example
-- they behave like generators in many respects except that you are
responsible for tracking state and jumping to an appropriate resume
point. Being C, it won't be as convenient as Python generators, but
should be able to translate any generator into equivalent C.
Raymond Hettinger
More information about the Python-list
mailing list