On Thu, May 8, 2008 at 1:40 PM, Dave Kuhlman <[EMAIL PROTECTED]> wrote:
> On Thu, May 08, 2008 at 09:10:29PM +0530, Sandip Bhattacharya wrote:
>  Take a look at the optional "bufsize" argument to the "open" built-in
>  function:
>
>     "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 tty devices and fully buffered for other files. If
>     omitted, the system default is used."
>
>        -- http://docs.python.org/lib/built-in-funcs.html#l2h-54
>
>  Looks to me that the buffering is done for you, but that you can
>  control it a bit.

Footnote 2.3 says, "Specifying a buffer size currently has no effect
on systems that don't have setvbuf(). The interface to specify the
buffer size is not done using a method that calls setvbuf(), because
that may dump core when called after any I/O has been performed, and
there's no reliable way to determine whether this is the case."

So whether that works will depend on what OS the OP is using.

Presumably the underlying file system does at least block-level
buffering but I can't say for sure...

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to