30 Nov
2011
30 Nov
'11
8:38 p.m.
Peter Otten writes:
Éric Araujo wrote:
Okay. You can open a report on bugs.python.org to ask that the doc for readlines mention list(fp) as an alternative.
That would make sense to me only if readlines() were deprecated.
It makes sense to me. Something like Note that "for line in fp:" (to iterate over the lines of the file) and "list(fp)" (to get a list of all lines in a file) are idiomatic Python. to remind readers (especially new users) of the iterator concept, which is even today not so familiar to beginning programmers.