Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1fd526

Browse files
committed
GetoptError is always initialized with exactly two parameters, so simplify
the constructor.
1 parent b2a0a83 commit e1fd526

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

Lib/getopt.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
class GetoptError(Exception):
2121
opt = ''
2222
msg = ''
23-
def __init__(self, *args):
24-
self.args = args
25-
if len(args) == 1:
26-
self.msg = args[0]
27-
elif len(args) == 2:
28-
self.msg = args[0]
29-
self.opt = args[1]
23+
def __init__(self, msg, opt):
24+
self.msg = msg
25+
self.opt = opt
26+
Exception.__init__(self, msg, opt)
3027

3128
def __str__(self):
3229
return self.msg

0 commit comments

Comments
 (0)