Semantics of file.close()

Hrvoje Niksic hniksic at
Wed Jul 18 12:55:01 CEST 2007

"Evan Klitzke" <evan at> writes:

>> But the writes are buffered, and close causes the buffer to be
>> flushed.  file.close can throw an exception just like fclose, but
>> it will still ensure that the file is closed.
> Is this buffering being done by Python or the kernel?

It is done in the user space, by the C stdio library which Python
currently uses for IO.

More information about the Python-list mailing list