Alan Isaac wrote: > "Peter Otten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I like >> >> >>> items = range(9) >> >>> N = 3 >> >>> zip(*[iter(items)]*N) >> [(0, 1, 2), (3, 4, 5), (6, 7, 8)] > > Except that it is considered implementation dependent: > http://mail.python.org/pipermail/python-list/2005-February/307550.html
Use itertools.izip() then instead of zip(). I think that the occurence of this idiom on the examples page counts as a blessing :-) But still, to help my lack of fantasy -- what would a sane zip() implementation look like that does not guarantee the above output? Peter -- http://mail.python.org/mailman/listinfo/python-list