Re: Built-in open() with buffering > 1

2012-08-30 Thread Marco
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

Re: Built-in open() with buffering > 1

2012-08-26 Thread Hans Mulder
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

Re: Built-in open() with buffering > 1

2012-08-24 Thread Ramchandra Apte
`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,

Re: Built-in open() with buffering > 1

2012-08-23 Thread Marco
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

Built-in open() with buffering > 1

2012-08-23 Thread Marco
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.