Move the __getitem__() definition from StandardException to Exception.

This allows stuff like this out of the box:

	try:
	    ...
	except socket.error, (code, msg):
	    ...
This commit is contained in:
Fred Drake 1997-10-06 15:48:20 +00:00
parent bf9d353bab
commit 596db3161c
1 changed files with 3 additions and 1 deletions

View 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 = ""