New submission from Antony Lee <anntzer....@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 <rep...@bugs.python.org> <https://bugs.python.org/issue39716> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com