paul j3 <ajipa...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34744>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to