[Python-3000] iostack, second revision

Anders J. Munch ajm at flonidan.dk
Tue Sep 12 09:01:01 CEST 2006

Greg Ewing wrote:
> Anders J. Munch wrote:
> > any file that supports seeking to the end will also support
> > reporting the file size.  Thus
> >   f.seek(f.length)
> > should suffice,
> Although the micro-optimisation circuit in my
> brain complains that it will take 2 system
> calls when it could be done with 1...

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.

My micro-optimisation circuitry blew a fuse when I discovered that
seek always implies flush.  You won't get good performance out of code
that does a lot of seeks, whatever you do.  Use my upcoming FileBytes
class :)

- Anders

More information about the Python-3000 mailing list