[Python-Dev] file.next() vs. file.readline()

Thomas Wouters thomas at xs4all.net
Thu Jan 5 19:30:08 CET 2006


On Wed, Jan 04, 2006 at 10:10:07AM -0800, Guido van Rossum wrote:

> I'd say go right ahead and submit a change to SF (and then after it's
> reviewed you can check it in yourself :-).

http://www.python.org/sf?id=1397960

The patch comments and source should explain it all. The diff is quite big
(just over 16k) because of the 16k testfile. As for checking in myself, I
think my write-access was (rightly, considering my absense) removed sometime
last year :)

> In Py3K I want to revise the whole I/O stack to be independent from C
> stdio (except on those platforms where that's the only I/O you have.)

When I first read that, I thought "yuuuuck". Then I went and actually read
all of fileobject.c, went "yuuuuck" more times than I cared to count, and
now I wholeheartedly agree ;)

Changing the read* methods to use the file-iteration buffer would be a lot
simpler than I thought, by the way. And it would simplify a lot of the code
(not just because of the code duplication currently necessary.) I'm sure
there'll be people who like having direct control over howmuch gets read
though. Which is fine, I think that should stay possible, but I don't think
those people deserve to get the full force of Tim's optimizations either.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!


More information about the Python-Dev mailing list