This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Antony.Lee
Recipients Antony.Lee
Date 2020-02-21.18:20:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582309254.51.0.588412851994.issue39716@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-02-21 18:20:54Antony.Leesetrecipients: + Antony.Lee
2020-02-21 18:20:54Antony.Leesetmessageid: <1582309254.51.0.588412851994.issue39716@roundup.psfhosted.org>
2020-02-21 18:20:54Antony.Leelinkissue39716 messages
2020-02-21 18:20:54Antony.Leecreate