[Python-Dev] IO module precisions and exception hierarchy

Antoine Pitrou solipsis at pitrou.net
Mon Sep 28 00:38:31 CEST 2009


Le Mon, 28 Sep 2009 06:41:17 +1000, Nick Coghlan a écrit :
> 
> 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).

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.

Regards

Antoine.



More information about the Python-Dev mailing list