On Jan 17, 4:38 pm, Bruno Desthuilliers <bruno.
[EMAIL PROTECTED]> wrote:
> Now there are very certainly smart solutions using itertools, but the
> one I cooked is way too ugly so I'll leave this to itertools masters !-)

Here's my effort:

from itertools import izip, islice, chain, repeat

def padzip(*xs, **kw):
    pad = kw.get('padding', None)
    maxlen = max(len(x) for x in xs)
    return islice(izip(*[chain(x, repeat(pad)) for x in xs]), maxlen)

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

Reply via email to