Message373435
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. |
|
Date |
User |
Action |
Args |
2020-07-10 00:20:24 | calestyo | set | recipients:
+ calestyo, rhettinger, bethard, Danh, wm, paul.j3, atfrase, brandtbucher, shihai1991, alclarks |
2020-07-10 00:20:24 | calestyo | set | messageid: <1594340424.12.0.451013021796.issue11354@roundup.psfhosted.org> |
2020-07-10 00:20:24 | calestyo | link | issue11354 messages |
2020-07-10 00:20:23 | calestyo | create | |
|