G
Genstein
Hey all,
Apologies if this is a dumb question (self = Python noob), but under
py3k is it necessary to flush() a file between read/write calls in order
to see consistent results?
I ask because I have a case under Python 3.2 (r32:88445) where it does
appear to be, on both Gentoo Linux and Windows Vista.
I've naturally read http://docs.python.org/py3k/library/io.html and
http://docs.python.org/py3k/tutorial/inputoutput.html#reading-and-writing-files
but could find no reference to such a requirement.
PEP 3116 suggested this might not be required in py3k and the
implementation notes in bufferedio.c state "BufferedReader,
BufferedWriter and BufferedRandom...share a single buffer...this enables
interleaved reads and writes without flushing." Which seemed conclusive
but I'm seeing otherwise.
I have a test case, which is sadly rather long:
http://pastebin.com/xqrzKr5D It's lengthy because it's autogenerated
from some rather more complex code I'm working on, in order to reproduce
the issue in isolation.
Any advice and/or flames appreciated.
All the best,
-eg.
Apologies if this is a dumb question (self = Python noob), but under
py3k is it necessary to flush() a file between read/write calls in order
to see consistent results?
I ask because I have a case under Python 3.2 (r32:88445) where it does
appear to be, on both Gentoo Linux and Windows Vista.
I've naturally read http://docs.python.org/py3k/library/io.html and
http://docs.python.org/py3k/tutorial/inputoutput.html#reading-and-writing-files
but could find no reference to such a requirement.
PEP 3116 suggested this might not be required in py3k and the
implementation notes in bufferedio.c state "BufferedReader,
BufferedWriter and BufferedRandom...share a single buffer...this enables
interleaved reads and writes without flushing." Which seemed conclusive
but I'm seeing otherwise.
I have a test case, which is sadly rather long:
http://pastebin.com/xqrzKr5D It's lengthy because it's autogenerated
from some rather more complex code I'm working on, in order to reproduce
the issue in isolation.
Any advice and/or flames appreciated.
All the best,
-eg.