I just came across this piece of code
while 1: line = data.readline() if not line: break #...
and thought, there must
for line in data: ... process line somehow....
Will iterate over each line in the file, rather than using a while. It is a much more common idiom for the task of reading a file in my experience (in Python).
file
while
In fact, data does not have to be a file but merely provide an iterator.
data