Generators for Engineers

A gentle introduction to infinite sequences.

Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.

This is ugly, but it gets the job done. xrange() works as expected. Notice how I've been printing data instead of building the results into a new list? We are going to make this example into a generator by simply replacing the print with a yield.

Mail: (not shown)

Please type this: