speed problems

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Thu Jun 3 11:50:44 EDT 2004


Axel Scheepers wrote:

> Another difference might be while( <filehandle>) and line in lf.readlines().
> The latter reads the whole file to memory if I'm not mistaken as the former
> will read the file line by line. Why that could make such a difference I
> don't know.

line in lf also reads the file line by line, if you're using 2.3. In 2.1 
or 2.2 you can use xreadlines for that. I don't if it makes any 
difference in performance though, for small files.

-- 
"Codito ergo sum"
Roel Schroeven



More information about the Python-list mailing list