Default buffer size for open()
Hrvoje Niksic
hniksic at arsdigita.com
Thu Nov 16 10:10:00 EST 2000
"June Kim" <junaftnoon at nospamplzyahoo.com> writes:
> [quote]
> The optional bufsize argument specifies the file's desired buffer size: 0
> means unbuffered, 1 means line buffered, any other positive value means use
> a buffer of (approximately) that size. A negative bufsize means to use the
> system default, which is usually line buffered for for tty devices and fully
> buffered for other files. If omitted, the system default is used.
> [eoq]
>
> According to this, open(), without the optional bufsize argument,
> buffers the whole file when reading in a file other than tty
> devices.
No. "Fully buffered" is misleading. It just means that normal
buffering is used, with a default (and unknown) size of the buffer, as
determined by stdio. This size is system-dependent and usually equals
the block size of the kernel buffers that implement reading and
writing (4K, 8K or so).
> If it is not, how to get the default buffer size?
I don't think you can.
More information about the Python-list
mailing list