common: move izip() from recv module and refactor it a bit

This commit is contained in:
Roman Zeyde
2014-09-07 18:24:40 +03:00
parent d22ef08966
commit bc4497ed1b
3 changed files with 13 additions and 7 deletions

View File

@@ -93,6 +93,13 @@ def take(iterable, n):
return np.array(list(itertools.islice(iterable, n)))
# "Python 3" zip re-implementation for Python 2
def izip(iterables):
iterables = [iter(iterable) for iterable in iterables]
while True:
yield tuple([next(iterable) for iterable in iterables])
class Dummy(object):
def __getattr__(self, name):