Message9489
Logged In: YES
user_id=10327
I'm in favor for the "let files be their own iterator and set .next equal to .readline" solution. The above example can _really_ bite you.
The current xreadlinesmodule.c could be converted to a standalone module, if it really is necessary to optimize.
The trivial solution for this problem is to change CHUNKSIZE (in Modules/xreadlinesmodule) to 1. Or, even better, to convert it into an instance variable, so you can do this:
f=open(...)
fi=f.iter(chunk=2000)
for line in fi:
...
if you want speed, or just write
for line in f:
(which internally converts to f.iter(chunk=1))
if you want safety.
I'm not too firm with Python C interfacing, otherwise I'd write a patch... any takers? |
|
Date |
User |
Action |
Args |
2007-08-23 13:59:33 | admin | link | issue524804 messages |
2007-08-23 13:59:33 | admin | create | |
|