Skip to content

Commit 69c08e7

Browse files
Add comments.
1 parent 74edc92 commit 69c08e7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/argparse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,13 +937,15 @@ def __init__(self,
937937
_option_strings.append(option_string)
938938

939939
if len(option_string) > 2 and option_string[0] == option_string[1]:
940+
# two-dash long option: '--foo' -> '--no-foo'
940941
if option_string.startswith('no-', 2):
941942
raise ValueError(f'invalid option name {option_string!r} '
942943
f'for BooleanOptionalAction')
943944
option_string = option_string[:2] + 'no-' + option_string[2:]
944945
_option_strings.append(option_string)
945946
neg_option_strings.append(option_string)
946947
elif len(option_string) > 2 and option_string[0] != option_string[1]:
948+
# single-dash long option: '-foo' -> '-nofoo'
947949
if option_string.startswith('no', 1):
948950
raise ValueError(f'invalid option name {option_string!r} '
949951
f'for BooleanOptionalAction')

0 commit comments

Comments
 (0)