From 596db3161c8cf0a492f5613cb5721b6c12c1dceb Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Mon, 6 Oct 1997 15:48:20 +0000 Subject: [PATCH] Move the __getitem__() definition from StandardException to Exception. This allows stuff like this out of the box: try: ... except socket.error, (code, msg): ... --- Lib/exceptions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/exceptions.py b/Lib/exceptions.py index 686ba381587..c7bbbf491ea 100644 --- a/Lib/exceptions.py +++ b/Lib/exceptions.py @@ -58,10 +58,12 @@ def __str__(self): 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 = ""