Skip to content

Commit

Permalink
Remove redundant if check from optional argument function in argparse. (
Browse files Browse the repository at this point in the history
  • Loading branch information
sp1rs authored and benjaminp committed Jun 21, 2019
1 parent 1e61504 commit b9600b0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Lib/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,10 +1479,8 @@ def _get_optional_kwargs(self, *args, **kwargs):

# 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)
Expand Down

0 comments on commit b9600b0

Please sign in to comment.