Iterators in python are so easy. I saw some articles on random sites about building generators to do stuff, but in the end they were only trying to iterate through a file line by line so why make it harder on yourself. Declare an iterator of the type you’re dealing with, like lines in a file, and vrooom, off you go.
f = open(infile,’r')
lines = f.readlines()
i = iter(lines)
while true:
. try:
. line = i.next()
. except StopIteration:
. pass