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

Krzysztof Leszczyński report at bugs.python.org
Mon Feb 12 10:09:55 EST 2018


New submission from Krzysztof Leszczyński <chris.lesz at gmail.com>:

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 instead it raises an error, in spite that --a-b and --ab are aliases

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32833>
_______________________________________


More information about the Python-bugs-list mailing list