[issue1708] improvements for linecache

umaxx report at bugs.python.org
Tue Jan 6 22:27:44 CET 2009


umaxx <umaxx at oleco.net> added the comment:

> Looking at the patch, the recorded seek points will probably be wrong if
> some newlines were translated (e.g. '\r\n' -> '\n') when reading the file.

ack, this could be a problem.

> I'm also not sure not what the use case for very big files is. 

this is easy to answer: i used it for example for parsing (still
growing) big log files from mail servers. parsing the whole file first
time, and than later: starting from line xyz+1 (xyz was the last line
recorded after first time parsing) *without* parsing the whole file
again. especially very useful for growing log files >1GB

just try to get linenumber 1234567 from a 2,3GB log file with the
current linecache implementation :)
the main idea behind the patch is to cache the seek points to save a lot
of time on big files.

> linecache is primarily used for printing tracebacks, the API 
> isn't really general-purpose.

i know :)

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1708>
_______________________________________


More information about the Python-bugs-list mailing list