Why is text file processing SO slow?

Aahz Maruch aahz at panix.com
Wed Sep 20 23:08:40 EDT 2000


[posted with cc to python-docs]

In article <slrn8siuqj.d7u.rickp at tc.niof.net>,
Rick Pasotto <rickp at telocity.com> wrote:
>On 20 Sep 2000 17:46:46 -0700 in comp.lang.python, Aahz Maruch wrote:
>>
>> Use readlines() with the hint argument so you don't consume too much
>> RAM.
>
>What is this "hint argument?" It's not mentioned in the docs that I
>have. Furthermore, the tutorial says that readlines() calls readline()
>repeatedly so I don't see why there should be any speed difference.

I believe the tutorial is incorrect; more precisely, after looking at it
myself, the tutorial is misleading.  My docs say 

    readlines ([sizehint])

in the library reference ("Other built-in types") and go on to explain
that sizehint is in bytes, but that (unlike the size argument for
readline()) you are guaranteed that you will only get entire lines.

If you really want speed, there's a QIO module out somewhere.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Member of the Groucho Marx Fan Club  --Aahz



More information about the Python-list mailing list