Generators versus Coroutines

Paul McGuire ptmcg at
Mon Aug 16 09:05:28 CEST 2004

"Timothy Fitz" <firemoth at> wrote in message
news:972ec5bd.0408152033.19fdcba4 at
> Dominic <nomail at> wrote in message
news:<cfn0oa$112$1 at>...
> > > values. I am currently writing a real time strategy game where I have
> > I have written a simple 2D-real-time vehicle simulator in Python
> >    (+ graphics library Allegro), using chained generators
> > which works well enough.
> >
> > If your game is more ambitious, spend some time designing
> >   a good architecture and specify your components' interfaces.
> > Then you could generate your code-skeleton from that;
> > simple generators should be sufficient to implement
> > your methods which are then driven by your architectures
> > "execution model".
> >
> > ciao,
> >   Dominic
> It really was never an issue of "Python can't handle this." it was
> more of an issue of "Python should more openly support this." I am
> championing generators because they make programming SO much easier in
> cases, and people really just don't use them outside if list
> generation, which saddens me.

Have you looked at SimPy?  This is a discrete event simulation package in
pure Python, using generators in simulation objects to implement the
objects' behavior, while managing state, blocking on waits between objects,
etc.  I think this may be more in the realm you are thinking, beyond simple
"list generation."

-- Paul

More information about the Python-list mailing list