[issue32833] argparse doesn't recognise two option aliases as equal

2018-09-29 Thread paul j3
paul j3 added the comment: I'm going to close this issue. The current behavior is a logical consequence of how option_strings and abbreviations are handled. Handling this particular case differently would be require adding a special test, as opposed to a minor tweak to the current code.

[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread paul j3
paul j3 added the comment: When I run your setup in ipython, I see a display of the newly added Action: Out[2]: _StoreAction(option_strings=['--a-b', '--ab'], dest='a_b', nargs=None, const=None, default=None, type=None, choices=None, help=None, metavar=None)

[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread paul j3
paul j3 added the comment: Subparsers have aliases, argument option strings don't, at least not formally. Once an argument is added, its flags are entered in several lists. One list belongs to the Action itself, another belongs to the parser (it might actually be a

[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: To be clear, the specific error is: error: ambiguous option: --a could match --a-b, --ab which makes sense if they're separate switches, but doesn't make sense when both expansions are aliases of one another. -- nosy:

[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread paul j3
Change by paul j3 : -- nosy: +paul.j3 ___ Python tracker ___ ___ Python-bugs-list

[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread Krzysztof Leszczyński
New submission from Krzysztof Leszczyński : Step to reproduce: import argparse ap=argparse.ArgumentParser() ap.add_argument("--a-b", "--ab") v1=ap.parse_args(["--ab", "xx"]) print(v1) # v1==Namespace(a_b='xx') v2=ap.parse_args(["--a", "xx"]) # v2 should be equal to v1 but

[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread Krzysztof Leszczyński
Change by Krzysztof Leszczyński : -- components: Library (Lib) nosy: Krzysztof Leszczyński priority: normal severity: normal status: open title: argparse doesn't recognise two option aliases as equal type: behavior versions: Python 3.5