mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Updated a docstring and added an assert.
This commit is contained in:
parent
ad4fef4542
commit
19c9868597
@ -74,6 +74,7 @@ def reversed(L):
|
||||
|
||||
def window(L, size):
|
||||
"""Returns a sliding 'window' through the list L of size size."""
|
||||
assert not isinstance(L, int), 'Argument order swapped: window(L, size)'
|
||||
if size < 1:
|
||||
raise ValueError, 'size <= 0 disallowed.'
|
||||
for i in xrange(len(L) - (size-1)):
|
||||
|
@ -453,7 +453,9 @@ def mktemp(suffix=''):
|
||||
return sha.sha(s + str(time.time())).hexdigest() + suffix
|
||||
|
||||
def itersplit(isSeparator, iterable, maxsplit=-1, yieldEmpty=False):
|
||||
"""Splits an iterator based on a predicate isSeparator."""
|
||||
"""itersplit(isSeparator, iterable, maxsplit=-1, yieldEmpty=False)
|
||||
|
||||
Splits an iterator based on a predicate isSeparator."""
|
||||
acc = []
|
||||
for element in iterable:
|
||||
if maxsplit == 0 or not isSeparator(element):
|
||||
|
Loading…
Reference in New Issue
Block a user