]> granicus.if.org Git - python/commitdiff
Move the __getitem__() definition from StandardException to Exception.
authorFred Drake <fdrake@acm.org>
Mon, 6 Oct 1997 15:48:20 +0000 (15:48 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 6 Oct 1997 15:48:20 +0000 (15:48 +0000)
This allows stuff like this out of the box:

try:
    ...
except socket.error, (code, msg):
    ...

Lib/exceptions.py

index 686ba381587be8ad8ffda3ab67407b3b4549bc6c..c7bbbf491eaf5d2a340b433fa65b91a9a0aa89b6 100644 (file)
@@ -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 = ""