Message326707
https://bugs.python.org/issue13280, argparse should use the new Formatter class
Raymond Hettinger argued against making such a switch.
However there may be some value in allowing its use in parallel with the '%' style of formatting. That is, if the 'help' string has '%(...)' use the '%' formatting, if it has '{}' compatible formats use the '.format' expression. I think that can be done transparently; but I haven't tested it.
The reason I bring it up here, is that I think `.format' can provide the functionality this issue is asking for.
If I define an Action like:
a1 = parser.add_argument('--foo', '-f', default='foobar'.
help='help for {dest} or {option_strings[0]}, default is {default}'
Then:
a1.help.format(**vars(a1))
produces:
'help for foo or --foo, default is foobar'
So if there is another reason to add new style formatting to help lines, it's worth keeping this issue in mind. |
|
Date |
User |
Action |
Args |
2018-09-30 06:45:52 | paul.j3 | set | recipients:
+ paul.j3, helmsman helmsman |
2018-09-30 06:45:52 | paul.j3 | set | messageid: <1538289952.59.0.545547206417.issue34744@psf.upfronthosting.co.za> |
2018-09-30 06:45:52 | paul.j3 | link | issue34744 messages |
2018-09-30 06:45:52 | paul.j3 | create | |
|