diff options
author | Fred Drake <fdrake@acm.org> | 1997-10-06 15:48:20 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1997-10-06 15:48:20 (GMT) |
commit | 596db3161c8cf0a492f5613cb5721b6c12c1dceb (patch) | |
tree | 2341eb9f5f2c455f9c606333373f53d96bc6ea10 | |
parent | bf9d353babbd4126fc080a9a84ae65cc529b209d (diff) | |
download | cpython-596db3161c8cf0a492f5613cb5721b6c12c1dceb.zip cpython-596db3161c8cf0a492f5613cb5721b6c12c1dceb.tar.gz cpython-596db3161c8cf0a492f5613cb5721b6c12c1dceb.tar.bz2 |
Move the __getitem__() definition from StandardException to Exception.
This allows stuff like this out of the box:
try:
...
except socket.error, (code, msg):
...
-rw-r--r-- | Lib/exceptions.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/exceptions.py b/Lib/exceptions.py index 686ba38..c7bbbf4 100644 --- a/Lib/exceptions.py +++ b/Lib/exceptions.py @@ -58,10 +58,12 @@ class Exception: 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 = "" |