A bug with file.tell()?
Nick Jacobson
nicksjacobson at yahoo.com
Fri Sep 10 18:04:08 EDT 2004
>
> That means the underlying file handle is at
> the end and everything remaining is in memory.
>
Thanks a lot for the reply, it explains the problem very well.
But not allowing "for line in file" and read(), tell(), etc. together
still seems like a bug to me. And it's true that it's documented, but
the problem is buried in the documentation under next(), which is not
directly called!
Here's one idea: Have functions read(), tell(), etc. use the
read-ahead buffer for reference, instead of the file handle.
Here's another: raise an exception if calling read(), tell(), etc.
when the file handle != the read ahead buffer.
There has got to be a way to make these things consistent! Otherwise,
if it were up to me, I would avoid the read-ahead entirely, reasoning
that trading speed for buggy behavior is a bad practice...
What do you think?
More information about the Python-list
mailing list