mendelmaleh <mendelma...@gmail.com> added the comment:
When using more than one flag for an argument, it is redundant to have the choices more than once, since they are the same argument and have the same choices. Showing it once means cleaner output, and often means that the other option lines are shorter, like in the test case. ### sample code ```py import argparse ap = argparse.ArgumentParser(allow_abbrev=False) ap.add_argument('-c', '--choices', choices=['a', 'b', 'c']) ap.parse_args() ``` ### previous output ``` usage: main.py [-h] [-c {a,b,c}] optional arguments: -h, --help show this help message and exit -c {a,b,c}, --choices {a,b,c} ``` ### new output ``` usage: main.py [-h] [-c {a,b,c}] optional arguments: -h, --help show this help message and exit -c, --choices {a,b,c} ``` ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42258> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com