On 08/26/2012 10:25 AM, Hans Mulder wrote:
The algorithm is explained at
http://docs.python.org/library/io.html#io.DEFAULT_BUFFER_SIZE
Thanks ;)
In other words: open() tries to find a suitable size by
calling os.stat(your_file).st_blksize and if that fails,
it uses io.DEFAULT_BUFFER_SIZE, wh
On 24/08/12 06:35:27, Marco wrote:
> 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
Th
`f._CHUNK_SIZE = 5` is modifying Python's internal variables - don't do that
google buffering to find out what it is
buffering is how much Python will keep in memory
f.read(1) will actually read `buffering` bytes of memory so that when you read
later, the reading can be done from memory
On Friday,
On 08/24/2012 06:35 AM, Marco wrote:
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."
Sorry, I get it:
>>> f = open('myfile', 'w', buffering=2)
>>> f._CHUNK_SIZE = 5
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.