Updated a docstring and added an assert.

This commit is contained in:
Jeremy Fincher 2004-09-12 20:28:30 +00:00
parent ad4fef4542
commit 19c9868597
2 changed files with 4 additions and 1 deletions

View File

@ -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)):

View File

@ -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):