]> granicus.if.org Git - python/commitdiff
GetoptError is always initialized with exactly two parameters, so simplify
authorFred Drake <fdrake@acm.org>
Mon, 8 Jan 2001 15:39:32 +0000 (15:39 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 8 Jan 2001 15:39:32 +0000 (15:39 +0000)
the constructor.

Lib/getopt.py

index a8ad645bee6480a371883beba1d424bf83a93013..1bc42bd6a62ed769abe2561e9ca2159d3c54989b 100644 (file)
@@ -20,13 +20,10 @@ option involved with the exception.
 class GetoptError(Exception):
     opt = ''
     msg = ''
-    def __init__(self, *args):
-        self.args = args
-        if len(args) == 1:
-            self.msg = args[0]
-        elif len(args) == 2:
-            self.msg = args[0]
-            self.opt = args[1]
+    def __init__(self, msg, opt):
+        self.msg = msg
+        self.opt = opt
+        Exception.__init__(self, msg, opt)
 
     def __str__(self):
         return self.msg