mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Use isinstance for the type check, use booleans.
This commit is contained in:
parent
a48cb8f77d
commit
33b77de106
1 changed files with 4 additions and 4 deletions
|
@ -108,7 +108,7 @@ def gnu_getopt(args, shortopts, longopts = []):
|
|||
|
||||
opts = []
|
||||
prog_args = []
|
||||
if type(longopts) == type(""):
|
||||
if isinstance(longopts, str):
|
||||
longopts = [longopts]
|
||||
else:
|
||||
longopts = list(longopts)
|
||||
|
@ -116,11 +116,11 @@ def gnu_getopt(args, shortopts, longopts = []):
|
|||
# Allow options after non-option arguments?
|
||||
if shortopts.startswith('+'):
|
||||
shortopts = shortopts[1:]
|
||||
all_options_first = 1
|
||||
all_options_first = True
|
||||
elif os.getenv("POSIXLY_CORRECT"):
|
||||
all_options_first = 1
|
||||
all_options_first = True
|
||||
else:
|
||||
all_options_first = 0
|
||||
all_options_first = False
|
||||
|
||||
while args:
|
||||
if args[0] == '--':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue