Mercurial > cpython-lru_cache-weakref
diff Lib/exceptions.py @ 6394:784a16f56643 legacy-trunk
Move the __getitem__() definition from StandardException to Exception.
This allows stuff like this out of the box:
try:
...
except socket.error, (code, msg):
...
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Mon, 06 Oct 1997 15:48:20 +0000 |
| parents | 5cdc3ca053d6 |
| children | fb4b4d069cc7 |
line wrap: on
line diff
--- a/Lib/exceptions.py Mon Oct 06 14:45:17 1997 +0000 +++ b/Lib/exceptions.py Mon Oct 06 15:48:20 1997 +0000 @@ -58,10 +58,12 @@ else: return str(self.args) -class StandardError(Exception): def __getitem__(self, i): return self.args[i] +class StandardError(Exception): + pass + class SyntaxError(StandardError): filename = lineno = offset = text = None msg = ""
