two generators working in tandem

john peter neuzhoundxx at yahoo.com
Fri Feb 10 16:45:12 EST 2006


I'd like to write two generators: one is a min to max sequence number generator that
  rolls over to min again once the max is reached. the other is a generator that cycles
  through N (say, 12) labels. currently, i'm using these generators in nested loops like
  this:
   
  seq_numbers = genSeqNum(min,max)
  for label in genLabel():
     for some_date in genDate(init):
        for i in xrange(0, LIMIT):
           print label, some_date, i, seq_numbers.next()
   
  The problem I'm trying to solve is this:
  when the seq_numbers generator rolls over, the label generator must be advanced
  to the next one "in tandem". does anyone has any suggestion? thanks for any hepl!

		
---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060210/ea04c96d/attachment.html>


More information about the Python-list mailing list