Message362421
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. |
|
Date |
User |
Action |
Args |
2020-02-21 18:20:54 | Antony.Lee | set | recipients:
+ Antony.Lee |
2020-02-21 18:20:54 | Antony.Lee | set | messageid: <1582309254.51.0.588412851994.issue39716@roundup.psfhosted.org> |
2020-02-21 18:20:54 | Antony.Lee | link | issue39716 messages |
2020-02-21 18:20:54 | Antony.Lee | create | |
|