This is precisely the situation mmap was made for :) It has almost the same methods as a file so it should be an easy replacement.
On Sat, May 15, 2010 at 10:05 AM, Nobody <nob...@nowhere.com> wrote: > On Fri, 14 May 2010 18:38:55 -0400, J wrote: > > >>> someone smarter than me can correct me, but file.write() will write > when > >>> it's buffer is filled, or close() or flush() are called. > >> > >> And, in all probability, seek() will either flush it immediately or > cause > >> the next write() to flush it before writing anything. > > > > Ahhh... I didn't know that... I thought seek() just moved the pointer > > through the file a little further.... > > Think about how this affects buffering. write() writes at the current file > position. If you write, then seek, then write, it can't just concatenate > the two sets of data, as that would "lose" the seek. > > Either the buffer has to contain multiple, distinct sets of data, each > with an associated position, or (far more likely), the original data must > be written to the correct location before the second set of data can be > stored. > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list