On Fri, May 27, 2016, at 09:18, Ben Finney wrote:
>     try:
>         short_routine()
>     except ConnectionRefusedError as exc:
>         handle_connection_refused(exc)
>     except OSError as exc:
>         if exc.errno == errno.ECONNREFUSED:
>             handle_connection_refused(exc)

But ConnectionRefusedError inherits from OSError and has errno =
ECONNREFUSED. So you can simply only have the second except block here,
and ignore the fact that Python 3 has a class hierarchy of error types.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to