Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27777
| From | Marco <marco_u@nsgmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Built-in open() with buffering > 1 |
| Date | 2012-08-24 06:35 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <k170ae$vbe$1@speranza.aioe.org> (permalink) |
Please, can anyone explain me the meaning of the
"buffering > 1" in the built-in open()?
The doc says: "...and an integer > 1 to indicate the size
of a fixed-size chunk buffer."
So I thought this size was the number of bytes or chars, but
it is not:
>>> f = open('myfile', 'w', buffering=2)
>>> f.write('a')
1
>>> open('myfile').read()
''
>>> f.write('b')
1
>>> open('myfile').read()
''
>>> f.write('cdefghi\n')
8
>>> open('myfile').read()
''
>>> f.flush()
>>> open('myfile').read()
'abcdefghi\n'
Regards,
Marco
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Built-in open() with buffering > 1 Marco <marco_u@nsgmail.com> - 2012-08-24 06:35 +0200
Re: Built-in open() with buffering > 1 Marco <marco_u@nsgmail.com> - 2012-08-24 07:21 +0200
Re: Built-in open() with buffering > 1 Ramchandra Apte <maniandram01@gmail.com> - 2012-08-24 07:32 -0700
Re: Built-in open() with buffering > 1 Hans Mulder <hansmu@xs4all.nl> - 2012-08-26 10:25 +0200
Re: Built-in open() with buffering > 1 Marco <marco_u@nsgmail.com> - 2012-08-30 17:39 +0200
csiph-web