2 Dec
2011
2 Dec
'11
3:02 p.m.
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 http://bugs.python.org/issue1633941 http://bugs.python.org/issue3907 http://utcc.utoronto.ca/~cks/space/blog/python/FileIteratorProblems readline() and readlines() don't have these problems. -M-