On Mon, Jan 5, 2009 at 12:01 PM, Antoine Pitrou <solip...@pitrou.net> wrote: > Amaury (mainly) and I are rewriting the IO stack in C,
Very cool! > and there is a small > thing in PEP 3116 about the BufferedRandom object that I'd like to clarify: > > « Q: Do we want to mandate in the specification that switching between reading > and writing on a read-write object implies a .flush()? Or is that an > implementation convenience that users should not rely on? » > > Is it ok if I assume that the answer is "it is an implementation convenience > that users should not rely on"? The reason is that I'm overhauling > BufferedRandom objects to use a single shared buffer, so as to optimize > interleaved reads and writes. I think it's fine if the flush to the file is optional, as long as this is clearly documented. However, the semantics of interleaving reads and writes, with and without seek calls in between, should be well-defined and correct/useful, so that it behaves the same regardless of the buffer size. Ditto for the flush call currently implied by a seek -- if you can satisfy the seek by moving where you are in the buffer without flushing, that's fine IMO, but it should be well documented. It should also be documented that a flush still *may* occur, of course. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com