"Raymond Hettinger" <[EMAIL PROTECTED]> writes:
> The generator version is plain, simple, boring, and uninspirational.
> But it took only seconds to write and did not require a knowledge of
> advanced itertool combinations. It more easily explained than the
> versions with zip tricks.
I had this cute idea of using dropwhile to detect the end of an iterable:
it = chain(iterable, repeat(''))
while True:
row = tuple(islice(it, group_size))
# next line raises StopIteration if row is entirely null-strings
dropwhile(lambda x: x=='', row).next()
yield row
--
http://mail.python.org/mailman/listinfo/python-list