Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5132
| From | Genstein <genstein@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | py3k buffered IO - flush() required between read/write? |
| Date | 2011-05-11 17:27 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <iqedg8$k5a$7@dont-email.me> (permalink) |
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.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
py3k buffered IO - flush() required between read/write? Genstein <genstein@invalid.invalid> - 2011-05-11 17:27 +0100
Re: py3k buffered IO - flush() required between read/write? Terry Reedy <tjreedy@udel.edu> - 2011-05-11 14:24 -0400
Re: py3k buffered IO - flush() required between read/write? Genstein <genstein@invalid.invalid> - 2011-05-11 20:08 +0100
Re: py3k buffered IO - flush() required between read/write? Terry Reedy <tjreedy@udel.edu> - 2011-05-11 17:38 -0400
Re: py3k buffered IO - flush() required between read/write? Genstein <genstein@invalid.invalid> - 2011-05-12 14:30 +0100
Re: py3k buffered IO - flush() required between read/write? Terry Reedy <tjreedy@udel.edu> - 2011-05-12 15:44 -0400
Re: py3k buffered IO - flush() required between read/write? Genstein <genstein@invalid.invalid> - 2011-05-12 21:38 +0100
Re: py3k buffered IO - flush() required between read/write? "Martin P. Hellwig" <martin.hellwig@gmail.com> - 2011-05-11 23:24 +0000
csiph-web