Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7015

Generator Frustration

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!69.16.185.51.MISMATCH!isp-post01.iad!news.highwinds-media.com!news.cv.net!not-for-mail
From "TommyVee" <xxxxxxxx@xxxxxx.xxx>
Newsgroups comp.lang.python
Subject Generator Frustration
Date Sat, 4 Jun 2011 14:27:32 -0400
MIME-Version 1.0
Content-Type text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding 7bit
X-Priority 3
X-MSMail-Priority Normal
Importance Normal
X-Newsreader Microsoft Windows Live Mail 15.4.3508.1109
X-MimeOLE Produced By Microsoft MimeOLE V15.4.3508.1109
Lines 13
Message-ID <4dea7932$0$28716$607ed4bc@cv.net> (permalink)
Organization Optimum Online
NNTP-Posting-Host 68.196.192.185
X-Complaints-To abuse@cv.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7015

Show key headers only | View raw


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 | NextNext in thread | Find similar | Unroll thread


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