From: Martin v. Löwis Date: Thu, 6 Jun 2002 18:14:50 +0000 (+0000) Subject: Use isinstance for the type check, use booleans. X-Git-Tag: v2.3c1~5443 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33b77de106cc49f3c7e03335d4ff989fa909b9e2;p=python Use isinstance for the type check, use booleans. --- diff --git a/Lib/getopt.py b/Lib/getopt.py index 3e8b7c2d60..fb98e88530 100644 --- a/Lib/getopt.py +++ b/Lib/getopt.py @@ -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] == '--':