Paul Rubin wrote:
> Michael Spencer <[EMAIL PROTECTED]> writes:
>>      for i in range(10):
>>          result = []
>>          ...
> 
> Do you mean "while True: ..."?
> 
oops, yes!

so, this should have been:

from itertools import repeat

def izip2(*iterables, **kw):
     """kw:fill. An element that will pad the shorter iterable"""
     fill = repeat(kw.get("fill"))
     iterables = map(iter, iterables)
     iters = range(len(iterables))

     while True:
         result = []
         for idx in iters:
             try:
                 result.append(iterables[idx].next())
             except StopIteration:
                 iterables[idx] = fill
                 if iterables.count(fill) == len(iterables):
                     raise
                 result.append(fill.next())
         yield tuple(result)

Michael

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to