[New-bugs-announce] [issue39716] argparse.ArgumentParser does not raise on duplicated subparsers, even though it does on duplicated flags
Antony Lee
report at bugs.python.org
Fri Feb 21 13:20:54 EST 2020
New submission from Antony Lee <anntzer.lee at gmail.com>:
If one tries to add twice the same flag to an ArgumentParser, one gets a helpful exception:
from argparse import ArgumentParser
p = ArgumentParser()
p.add_argument("--foo")
p.add_argument("--foo")
results in
argparse.ArgumentError: argument --foo: conflicting option string: --foo
However, adding twice the same subparser raises no exception:
from argparse import ArgumentParser
p = ArgumentParser()
sp = p.add_subparsers()
sp.add_parser("foo")
sp.add_parser("foo")
even though the two subparsers shadow one another in the same way as two identical flags.
----------
components: Library (Lib)
messages: 362421
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: argparse.ArgumentParser does not raise on duplicated subparsers, even though it does on duplicated flags
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39716>
_______________________________________
More information about the New-bugs-announce
mailing list