[Python-3000] iostack, second revision

Anders J. Munch ajm at flonidan.dk
Wed Sep 13 10:27:31 CEST 2006

Josiah Carlson wrote:
> "Anders J. Munch" <ajm at flonidan.dk> wrote:
> > I don't expect file methods and systems calls to map one to one, but
> > you're right, the first time the length is needed, that's an extra
> > system call.
> Every time the length is needed, a system call is required 
> (you can have
> multiple writers of the same file)...

Point taken.  It's very rarely a good idea to do so, but the
possibility of multiple writers shouldn't be ignored.  Still there is
no real performance issue.  If anything, replacing
f.seek(0,2);f.tell() with f.length in various places might save a few
system calls.

> Flushing during seek is important.  By not flushing during 
> seek in your
> FileBytes object, you are unnecessarily delaying writes, which could
> cause file corruption.

That's what the flush method is for.  The real reason seek implies
flush is to save the library author the bother of getting the
interactions between input and output buffering right.
Anyway, FileBytes has no seek and no concept of current file position,
so I really don't know what you're talking about :)

- Anders

More information about the Python-3000 mailing list