def start(env, lines):
while lines:
line, *lines = lines
if len(line) > 4 and line.startswith("+++"):
header(env, line)
modified(env, 0, lines)
Notes: while lines:
is pythonic for while not lines == []: