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 calestyo
Recipients Danh, alclarks, atfrase, bethard, brandtbucher, calestyo, paul.j3, rhettinger, shihai1991, wm
Date 2020-07-10.00:20:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594340424.12.0.451013021796.issue11354@roundup.psfhosted.org>
In-reply-to
Content
Next to code readability, there's IMO one could reason to properly support this would be a clean and easy way to get proper help strings for such options.

Of course I can do something like:
parser = argparse.ArgumentParser()
parser.add_argument("--foo", nargs="+", help="Mae govannen", metavar=("bar", "baz"))
args = parser.parse_args()

and later check that, say, only 2 arguments are allowed.

But the help text will be an ugly:
>$ python3 f.py --help
>usage: f.py [-h] [--foo bar [baz ...]]
>
>optional arguments:
>  -h, --help           show this help message and exit
>  --foo bar [baz ...]  Mae govannen

indicating that >1 options were allowed.
History
Date User Action Args
2020-07-10 00:20:24calestyosetrecipients: + calestyo, rhettinger, bethard, Danh, wm, paul.j3, atfrase, brandtbucher, shihai1991, alclarks
2020-07-10 00:20:24calestyosetmessageid: <1594340424.12.0.451013021796.issue11354@roundup.psfhosted.org>
2020-07-10 00:20:24calestyolinkissue11354 messages
2020-07-10 00:20:23calestyocreate