Added ilen, a function to return the length of an iterator.

This commit is contained in:
Jeremy Fincher 2003-08-07 06:13:11 +00:00
parent 36996dd3cf
commit 031c81e937
1 changed files with 6 additions and 0 deletions

View File

@ -227,6 +227,12 @@ def window(L, size):
for i in xrange(len(L) - (size-1)):
yield L[i:i+size]
def ilen(iterator):
i = 0
for _ in iterator:
i += 1
return i
## def group(seq, groupSize):
## L = []
## LL = []