Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7015
| From | "TommyVee" <xxxxxxxx@xxxxxx.xxx> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Generator Frustration |
| Date | 2011-06-04 14:27 -0400 |
| Message-ID | <4dea7932$0$28716$607ed4bc@cv.net> (permalink) |
| Organization | Optimum Online |
I'm using the SimPy package to run simulations. Anyone who's used this package knows that the way it simulates process concurrency is through the clever use of yield statements. Some of the code in my programs is very complex and contains several repeating sequences of yield statements. I want to combine these sequences into common functions. The problem of course, is that once a yield gets put into a function, the function is now a generator and its behavior changes. Is there any elegant way to do this? I suppose I can do things like ping-pong yield statements, but that solutions seems even uglier than having a very flat, single main routine with repeating sequences. Thanks in advance.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Generator Frustration "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2011-06-04 14:27 -0400
Re: Generator Frustration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-05 00:56 +0000
Re: Generator Frustration Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-05 13:43 +1200
Re: Generator Frustration Jack Diederich <jackdied@gmail.com> - 2011-06-04 22:06 -0400
Re: Generator Frustration "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2011-06-05 20:11 -0400
Re: Generator Frustration Jan Decaluwe <jan@jandecaluwe.com> - 2011-06-05 11:52 +0200
Re: Generator Frustration Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-06-06 11:07 +0200
Re: Generator Frustration "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2011-06-07 20:41 -0400
csiph-web