Buffering control in python?
jepler at unpythonic.net
jepler at unpythonic.net
Sat Oct 12 17:26:54 EDT 2002
I think that you have to do something like this:
def reopen(f, mode=None, bufsize=-1):
if mode is None: mode = f.mode
fd = f.fileno()
return os.fdopen(fd, mode, bufsize)
It shouldn't be hard to export an interface to setvbuf(3), I'm not sure why
this doesn't seem to exist. In that case, it would be much simpler:
f.setvbuf(0)
I'm not sure why the interface doesn't exist, except that setvbuf doesn't
exist on all systems.
Jeff
More information about the Python-list
mailing list