[issue9350] add remove_argument_group to argparse

2021-12-29 Thread Irit Katriel


Change by Irit Katriel :


--
stage: needs patch -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:

This is over a decade old and the discussion is mostly that it's not worth 
doing, so I suggest we close.

--
nosy: +iritkatriel
resolution:  -> rejected
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2019-08-18 Thread hai shi


hai shi  added the comment:

paul, raymond. Thanks for give me a quick answer:).
Looks raymond's reason is good enough, i just only consider this question from  
 
api completeness(as paul said) not from user case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2019-08-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> The use case for me is I create an argument group and 
> then conditionally add a bunch of arguments to it.  
> If zero arguments are added I would like to then remove
> the group so that an empty group does not show up 
> in the help output.

ISTM this use is likely rare enough that it doesn't warrant an API expansion.  
The argparse API is already somewhat large, so we should only expand it when 
there is a compelling benefit or the absence of a reasonable workaround (i.e. 
lazily adding a group only when the first argument is added).

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2019-08-18 Thread paul j3


paul j3  added the comment:

hai shi

Do you have a specific need for this, or do you want it just for the same of 
completeness?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2019-08-18 Thread hai shi


hai shi  added the comment:

IMHO, if we supply the ability to add an argument group, we need add the 
ability to remove the argument group too.

--
nosy: +shihai1991

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2014-09-28 Thread paul j3

paul j3 added the comment:

If the empty argument group has a 'description' it is displayed.  For example 
with positionals group that I mentioned earlier:

 parser = argparse.ArgumentParser()
 parser._action_groups[0].description = 'test'
 parser.print_help()

produces

usage: ipython [-h]

positional arguments:
  test

optional arguments:
   -h, --help  show this help message and exit

So the user can fix this empty group display issue by setting this 
'description' value to None.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9350
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2014-06-27 Thread paul j3

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 rep...@bugs.python.org
http://bugs.python.org/issue9350
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2014-06-16 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
nosy: +paul.j3
versions: +Python 2.7, Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9350
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2013-03-19 Thread Sanjeev Paskaradevan

Changes by Sanjeev Paskaradevan sanjeev@gmail.com:


--
nosy: +Sanjeev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9350
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2013-03-19 Thread Sanjeev Paskaradevan

Changes by Sanjeev Paskaradevan sanjeev@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file29489/remove_argument_group.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9350
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2013-03-19 Thread Sanjeev Paskaradevan

Changes by Sanjeev Paskaradevan sanjeev@gmail.com:


--
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9350
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9350] add remove_argument_group to argparse

2010-07-23 Thread Steven Bethard

New submission from Steven Bethard steven.beth...@gmail.com:

[From http://code.google.com/p/argparse/issues/detail?id=71]

There is a method ArgumentParser.add_argument_group() to create and add an 
argument group to the parser.  I would like the ability to remove an argument 
group via a method like remove_argument_group(group).

The use case for me is I create an argument group and then conditionally add a 
bunch of arguments to it.  If zero arguments are added I would like to then 
remove the group so that an empty group does not show up in the help output.

--
components: Library (Lib)
messages: 111321
nosy: bethard
priority: normal
severity: normal
stage: needs patch
status: open
title: add remove_argument_group to argparse
type: feature request

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9350
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com