Request for example of state machine using generators

Tim Peters tim.one at home.com
Tue Sep 18 02:00:09 EDT 2001


[MikeK]
> I'm trying to learn how to best use Python2.2 generators, and would
> appreciate someone posting an example of a simple state machine using
> generators.

The appeal of generators wrt state machines usually lies in not having to
maintain an explicit state machine at all, so yours is a paradoxical
request.

In 2.2a3 (or CVS), you can look at Tools/scripts/cleanfuture.py for an
extended example of using generators to avoid state machines, there in a
parsing context.  Lib/test/test_generators.py also has many examples of
generator techniques.





More information about the Python-list mailing list