Commit 33b77de1 authored by Martin v. Löwis's avatar Martin v. Löwis

Use isinstance for the type check, use booleans.

parent a48cb8f7
...@@ -108,7 +108,7 @@ def gnu_getopt(args, shortopts, longopts = []): ...@@ -108,7 +108,7 @@ def gnu_getopt(args, shortopts, longopts = []):
opts = [] opts = []
prog_args = [] prog_args = []
if type(longopts) == type(""): if isinstance(longopts, str):
longopts = [longopts] longopts = [longopts]
else: else:
longopts = list(longopts) longopts = list(longopts)
...@@ -116,11 +116,11 @@ def gnu_getopt(args, shortopts, longopts = []): ...@@ -116,11 +116,11 @@ def gnu_getopt(args, shortopts, longopts = []):
# Allow options after non-option arguments? # Allow options after non-option arguments?
if shortopts.startswith('+'): if shortopts.startswith('+'):
shortopts = shortopts[1:] shortopts = shortopts[1:]
all_options_first = 1 all_options_first = True
elif os.getenv("POSIXLY_CORRECT"): elif os.getenv("POSIXLY_CORRECT"):
all_options_first = 1 all_options_first = True
else: else:
all_options_first = 0 all_options_first = False
while args: while args:
if args[0] == '--': if args[0] == '--':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment