Generators versus Coroutines

Paul McGuire ptmcg at austin.rr._bogus_.com
Mon Aug 16 03:05:28 EDT 2004


"Timothy Fitz" <firemoth at gmail.com> wrote in message
news:972ec5bd.0408152033.19fdcba4 at posting.google.com...
> Dominic <nomail at nospam.no> wrote in message
news:<cfn0oa$112$1 at news.uni-kl.de>...
> > > 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