On 7/15/2011 8:26 AM, Billy Mays wrote:
On 07/15/2011 04:01 AM, bruno.desthuilli...@gmail.com wrote:
On Jul 14, 9:46 pm, Billy Mays<no...@nohow.com> wrote:
I noticed that if a file is being continuously written to, the file
generator does not notice it:

def getLines(f):
lines = []
for line in f:
lines.append(line)
return lines

what's wrong with file.readlines() ?

Using that will read the entire file into memory which may not be

So will getLines.

possible. In the library reference, it mentions that using the generator
(which calls file.next()) uses a read ahead buffer to efficiently loop
over the file. If I call .readline() myself, I forfeit that performance
gain.

Are you sure? Have you measured the difference?

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to