Understanding Python's "for" statement - effbot.org
Footnote: In Python 2.2 and later, several non-sequence objects have been extended to support the new protocol. For example, you can loop over both text files and dictionaries; the former return lines of text, the latter dictionary keys. for line in open(...