Steven Bethard <steven.beth...@gmail.com> added the comment:

And I guess the bigger issue to think about is how to add this in a backwards 
compatible way. I guess we could just add methods like 
"set_positionals_group_name(name)" and then fiddle with 
"self._positionals.title" in there. Not sure that's a great solution though - 
it seems like adding one method to change just this single attribute is 
overkill and not very general.

In the meantime, here's a workaround:

>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--foo', required=True)
>>> parser._optionals.title = "flag arguments"
>>> parser.print_help()
usage: PROG [-h] --foo FOO

flag arguments:
  -h, --help  show this help message and exit
  --foo FOO

I can't promise this will continue to work, since it uses the undocumented 
_optionals attribute, but at least it's a way of getting something like what 
you want now.

----------

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

Reply via email to