[Python-Dev] IO module precisions and exception hierarchy

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 27 13:16:38 CEST 2009

Pascal Chambon wrote:

> -> it seems that the only important matter is : file pointer positions 
> and bytes/characters read should always be the ones that the user 
> expects, as if there were no buffering.

That sounds right to me.

> Q from me : What happens in read/write text files, when overwriting a 
> three-bytes character with a single-byte character ?

I think you deserve whatever you get. If you want to be able
to overwrite things that accurately, you should be dealing
with the stream at the byte level.

> Here is a very rough beginning of IOError hierarchy.

>  +-InvalidFileNameError (filepath max lengths, or "? / : " characters in 
> a windows file name...)

This might be a bit too precise. Unix just has EINVAL, which
covers any kind of invalid parameter, not just file names.


More information about the Python-Dev mailing list