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 paul.j3
Recipients helmsman helmsman, paul.j3
Date 2018-09-30.06:45:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538289952.59.0.545547206417.issue34744@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-09-30 06:45:52paul.j3setrecipients: + paul.j3, helmsman helmsman
2018-09-30 06:45:52paul.j3setmessageid: <1538289952.59.0.545547206417.issue34744@psf.upfronthosting.co.za>
2018-09-30 06:45:52paul.j3linkissue34744 messages
2018-09-30 06:45:52paul.j3create