summaryrefslogtreecommitdiff
path: root/itertoolset.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-08-18 11:11:55 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-08-18 11:11:55 -0400
commit9eae1bf247f3b275d7a6a876e6379a6d910f4786 (patch)
treefe5463674db8c993e3f4d1fdb1614800725808d6 /itertoolset.py
parentf3589198dc7ffb765a2e76a8e608da1f169eb1ba (diff)
parent384f0b75d72cb034b8a148d4ae572f3f9cbe2454 (diff)
downloadchroma-9eae1bf247f3b275d7a6a876e6379a6d910f4786.tar.gz
chroma-9eae1bf247f3b275d7a6a876e6379a6d910f4786.tar.bz2
chroma-9eae1bf247f3b275d7a6a876e6379a6d910f4786.zip
merge
Diffstat (limited to 'itertoolset.py')
-rw-r--r--itertoolset.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/itertoolset.py b/itertoolset.py
index a20d03b..314ba0b 100644
--- a/itertoolset.py
+++ b/itertoolset.py
@@ -1,6 +1,11 @@
from itertools import *
import collections
+def grouper(n, iterable, fillvalue=None):
+ "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
+ args = [iter(iterable)] * n
+ return izip_longest(fillvalue=fillvalue, *args)
+
def roundrobin(*iterables):
"""roundrobin('ABC', 'D', 'EF') --> A D E B F C"""
pending = len(iterables)