[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-29 Thread paul j3
paul j3 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 h

[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-26 Thread paul j3
paul j3 added the comment: The preferred way of adding new features to the Formatter is to subclass it, and modify one or more methods. That's what the existing alternative formatters do. A user can easily create such a subclass, and use it with their own parser, without having to modify t

[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-24 Thread Vostretsov Nikita
Vostretsov Nikita added the comment: >'option_strings' is already being used in '_format_action_invocation()'. So I >don't see why this flag needs to appear again in the help line. 'option_strings' is available as a whole list, you can not use just first element of it >Though the user can

[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-22 Thread paul j3
Change by paul j3 : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ Py

[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-21 Thread paul j3
paul j3 added the comment: In your proposed change: params = dict(vars(action), prog=self._prog) + if action.option_strings: + params['flag'] = action.option_strings[0] 'params', as I noted earlier already includes the 'dest' and 'option_strings' list. 'option_st

[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-19 Thread paul j3
paul j3 added the comment: In your example, what is 'flag'? There's no Action attribute of that name. There is a 'dest' and a 'option_strings' list. All the 'help' '%(...)s' does is display one of the Action object attributes, the most common one is 'default'. Try this: a = parser.ad

[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-19 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch pull_requests: +8845 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-li

[issue34744] New %(flag)s format specifier for argparse.add_argument help string

2018-09-19 Thread helmsman helmsman
New submission from helmsman helmsman : Sometimes you want to provide format description in help message for argparse.add_argument, e.g. for comma-separated key/value set "--flag key1=value1,key2=value2". At this moment there is no format specifier for flag or name of arguments. I propose add