mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-09 12:29:22 +01:00
Added ilen, a function to return the length of an iterator.
This commit is contained in:
parent
36996dd3cf
commit
031c81e937
@ -227,6 +227,12 @@ def window(L, size):
|
|||||||
for i in xrange(len(L) - (size-1)):
|
for i in xrange(len(L) - (size-1)):
|
||||||
yield L[i:i+size]
|
yield L[i:i+size]
|
||||||
|
|
||||||
|
def ilen(iterator):
|
||||||
|
i = 0
|
||||||
|
for _ in iterator:
|
||||||
|
i += 1
|
||||||
|
return i
|
||||||
|
|
||||||
## def group(seq, groupSize):
|
## def group(seq, groupSize):
|
||||||
## L = []
|
## L = []
|
||||||
## LL = []
|
## LL = []
|
||||||
|
Loading…
Reference in New Issue
Block a user