code: def alternator(*pipes):
      ''' a lot like zip, just instead of:
              (a,b),(a,b),(a,b)
          it works more like:
              a,b,a,b,a,b,a
          until one of the pipes ends '''
      try:
          for p in cycle(map(iter, pipes)):
              yield next(p)
      except StopIteration:
          pasf alternator(*pipes):
      ''' a lot like zip, just instead of:
              (a,b),(a,b),(a,b)
          it works more like:
              a,b,a,b,a,b,a
          until one of the pipes ends '''
      try:
          for p in cycle(map(iter, pipes)):
              yield next(p)
      except StopIteration:
          pass
docs: a lot like zip, just instead of:
              (a,b),(a,b),(a,b)
          it works more like:
              a,b,a,b,a,b,a
          until one of the pipes ends