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

Skip to content

Commit 33b77de

Browse files
committed
Use isinstance for the type check, use booleans.
1 parent a48cb8f commit 33b77de

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/getopt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,19 @@ def gnu_getopt(args, shortopts, longopts = []):
108108

109109
opts = []
110110
prog_args = []
111-
if type(longopts) == type(""):
111+
if isinstance(longopts, str):
112112
longopts = [longopts]
113113
else:
114114
longopts = list(longopts)
115115

116116
# Allow options after non-option arguments?
117117
if shortopts.startswith('+'):
118118
shortopts = shortopts[1:]
119-
all_options_first = 1
119+
all_options_first = True
120120
elif os.getenv("POSIXLY_CORRECT"):
121-
all_options_first = 1
121+
all_options_first = True
122122
else:
123-
all_options_first = 0
123+
all_options_first = False
124124

125125
while args:
126126
if args[0] == '--':

0 commit comments

Comments
 (0)