[Python-Dev] IO module precisions and exception hierarchy

Michael Foord fuzzyman at voidspace.org.uk
Sun Sep 27 23:32:06 CEST 2009


Nick Coghlan wrote:
> Antoine Pitrou wrote:
>   
>> This deserves its own PEP IMO, although I'm not sure it would be accepted 
>> (ISTR the idea of a detailed IO exception hierarchy was already refused 
>> in the past).
>>     
>
> Not as such - a big exception hierarchy rewrite was rejected, but
> nothing specifically limited to the IO exceptions.
>
> Michael's response cut to the heart of the issue though - a richer IO
> exception hierarchy can make life interesting for compatibility purposes
> (especially when creating "file-like" interfaces to non-file objects).
>   

Some of the error messages are truly awful though as things stand, 
especially for someone new to Python. Try to read from a file handle 
opened in read mode for example: IOError: [Errno 9] Bad file descriptor

Michael

> Cheers,
> Nick.
>
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog




More information about the Python-Dev mailing list