[Python-Dev] IO module precisions and exception hierarchy

Nick Coghlan ncoghlan at gmail.com
Mon Sep 28 14:40:44 CEST 2009


Antoine Pitrou wrote:
> Le Mon, 28 Sep 2009 06:41:17 +1000, Nick Coghlan a écrit :
>> 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).
> 
> Well, not more interesting than currently where you need to replicate 
> errno numbers if you want to make the errors precise enough, since an API 
> consumer wanting to check specific error conditions will discriminate on 
> errno.
> 
> If you don't want to go to that level of perfection, you just have to 
> raise a plain IOError (or OSError :-)) without bothering about errno or 
> subclasses; like you would do today.

Fair point.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list