[Python-ideas] Is there a reason why file.readlines() doesn't/can't return an iterator?
tjreedy at udel.edu
Fri Dec 2 22:55:23 CET 2011
On 12/2/2011 4:02 PM, Matthew Woodcraft wrote:
> On 2011-11-30 13:59, Peter Otten wrote:
>> My observation on the Tutor mailing list is that there are no valid uses of
>> readlines(). It's just easier to discover the readlines() method than to
>> find out that you can iterate over the file directly.
> In 2.x, iterating directly can behave unexpectedly if the file object is
> something other than a regular file; see eg
Both are fixed in 3.x
> readline() and readlines() don't have these problems.
Terry Jan Reedy
More information about the Python-ideas