Added utils.iter.startswith.

This commit is contained in:
Jeremy Fincher 2005-02-17 23:30:54 +00:00
parent 4f99f41266
commit 4808a68f7d

View File

@ -148,4 +148,14 @@ def ilen(iterable):
i += 1
return i
def startswith(long, short):
longI = iter(long)
shortI = iter(short)
try:
while True:
if shortI.next() != longI.next():
return False
except StopIteration:
return True
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: