+ 1 for the lazy version. Why not using itertools.islice instead of the innermost for loop? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120901/8a083503/attachment.html>