diff options
author | Shashank Parekh <shashank201101193@gmail.com> | 2019-06-21 03:02:22 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2019-06-21 03:02:22 (GMT) |
commit | b9600b0fbd71908f9fb3dd1bf78ebba6c4a16115 (patch) | |
tree | 084faa8a4e53807c6993a07a83a146db4ed7071e /Lib/argparse.py | |
parent | 1e61504b8b941494f3ac03e0449ddbbba8960175 (diff) | |
download | cpython-b9600b0fbd71908f9fb3dd1bf78ebba6c4a16115.zip cpython-b9600b0fbd71908f9fb3dd1bf78ebba6c4a16115.tar.gz cpython-b9600b0fbd71908f9fb3dd1bf78ebba6c4a16115.tar.bz2 |
Remove redundant if check from optional argument function in argparse. (GH-8766)
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index 9a67b41..4f3aea9 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1479,10 +1479,8 @@ class _ActionsContainer(object): # strings starting with two prefix characters are long options option_strings.append(option_string) - if option_string[0] in self.prefix_chars: - if len(option_string) > 1: - if option_string[1] in self.prefix_chars: - long_option_strings.append(option_string) + if len(option_string) > 1 and option_string[1] in self.prefix_chars: + long_option_strings.append(option_string) # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' dest = kwargs.pop('dest', None) |