try... except with unknown error types

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Aug 21 20:30:37 EDT 2011


Chris Angelico wrote:


> A new and surprising mode of network failure would be indicated by a
> new subclass of IOError or EnvironmentError. 

/s/would/should/

I don't see why you expect this, when *existing* network-related failures
aren't:

>>> import socket
>>> issubclass(socket.error, EnvironmentError)
False

(Fortunately that specific example is fixed in Python 3.)

Besides, there's a world of difference between "should be" and "are".


-- 
Steven




More information about the Python-list mailing list