[issue9350] add remove_argument_group to argparse

paul j3 report at bugs.python.org
Fri Jun 27 22:59:40 CEST 2014


paul j3 added the comment:

I wonder if this patch is needed.

- there hasn't been discussion in 4 years

- In Steven's use case, a group without any arguments, the group does not show up.  A common example of an empty argument group, is a parser without any user defined arguments.  

    p=argparse.ArgumentParser(prog='PROG')
    p.print_help()

    usage: PROG [-h]
    optional arguments:
      -h, --help  show this help message and exit

The empty 'positional arguments' group is not displayed.

Removing a group that has arguments is more complicated (and error prone) since it requires removing those arguments as well.  There is a '_remove_action' method.  But as best I can tell it is only used by '_handle_conflict_resolve', a rarely used alternative conflict handler.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9350>
_______________________________________


More information about the Python-bugs-list mailing list