[docs] [issue13510] Clarify that readlines() is not needed to iterate over a file

Ezio Melotti report at bugs.python.org
Thu Dec 1 06:23:25 CET 2011

Ezio Melotti <ezio.melotti at gmail.com> added the comment:

FWIW I've seen several persons using "for line in file.readlines(): ..." or even "while 1: line = file.readline()".  IMHO it's a good idea to document that "without sizehint, it's equivalent to list(file)" and that "for line in file: ..." can be used directly.  Even if some people don't read the doc, the ones who do will benefit from this.  The same note might also be added to the docstring (I think it's somewhat common to learn about readlines() through dir(file) + help(file.readlines)).


Python tracker <report at bugs.python.org>

More information about the docs mailing list