I haven't found any way to get pylint (or other code analysis tools) to catch cases where there are overlapping/redundant exceptions caught like in the following example:
"""doc"""
import socket
try:
pass
except (ConnectionError, IOError, OSError, socket.error):
# ConnectionError inherits from OSError
# socket.error and IOError are aliases for OSError
pass
Here I would like to get a complaint about ConnectionError, IOError and socket.error already being covered by OSError in the except-clause.
In [1]: import socket
In [2]: OSError
Out[2]: builtins.OSError
In [3]: socket.error
Out[3]: builtins.OSError
In [4]: IOError
Out[4]: builtins.OSError
In [5]: ConnectionError, ConnectionError.__bases__
Out[5]: (builtins.ConnectionError, (builtins.OSError,))
Does this exists? If not, would this be a good/bad idea?
Now implemented here: Overlap-except-checker