[docs] [issue13510] Clarify that readlines() is not needed to iterate over a file
Terry J. Reedy
report at bugs.python.org
Wed Nov 30 23:54:26 CET 2011
Terry J. Reedy <tjreedy at udel.edu> added the comment:
This current line is
"Read and return a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint."
I would like to see added
"Since a file is a line iterator, file.readlines() == list(file). To save time and space, iterate over lines of a file with for line in file: process(line)."
(with code markup for the two snippets).
Python tracker <report at bugs.python.org>
More information about the docs