This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: action argument is not documented in argparse add_subparser() docs
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: AnneTheAgile, Mike.Short, Ubik, berker.peksag, bethard, docs@python, paul.j3, python-dev
Priority: normal Keywords: easy, patch

Created on 2014-08-31 20:39 by Ubik, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
argparse.patch Mike.Short, 2014-11-03 01:49 Patch for Python 3 review
argparse27.patch Mike.Short, 2014-11-03 01:49 Patch for Python 2 review
Messages (6)
msg226190 - (view) Author: (Ubik) Date: 2014-08-31 20:39
See: https://docs.python.org/2/library/argparse.html#argparse.ArgumentParser.add_subparsers
msg230527 - (view) Author: Mike Short (Mike.Short) * Date: 2014-11-03 01:49
I am uploading patches for both 2.7 as well as latest (3.x).  I only added the action verbiage itself in, but would it be beneficial to also add in links to more detailed descriptions similar to what is done in ArgumentParser.add_argument earlier in the argparse page?
msg234296 - (view) Author: Anne Moroney (AnneTheAgile) Date: 2015-01-19 01:31
This ticket's patch appears to have already been merged, yet it is open? 

On 2.7.9 docs [1], it has the exact language. The tutorial page [2] has a nice description as well. Finding this ticket really helped me understand argparse a bit better, and now I vote to close :).
AnneTheAgile, inspired by CodeTriage

1.[] ; ; ; ; ; ; ; ; ; ;  X.15.4. argparse — Parser for command-line options, arguments and sub-commands — Python 2.7.9 documentation
https://docs.python.org/2/library
action - The basic type of action to be taken when this argument is encountered at the command line.

2.[] ; ; ; ; ; ; ; ; ; ;  X.Argparse Tutorial — Python 2.7.9 documentation
https://docs.python.org/2/howto/argparse.html
we now specify a new keyword, action, and give it the value "store_true". This means that, if the option is specified, assign the value True to args.verbose. Not specifying it implies False.

3.[] ; ;List of all types of 'action', including customizable ; ; ; ; ; ; ; ;  X.15.4. argparse — Parser for command-line options, arguments and sub-commands — Python 2.7.9 documentation
https://docs.python.org/2/library/argparse.html#action
action="store_true"
action='store_false'
action="count"
action='store_const'
action='append'
action='version'
action=CustomFooAction
msg234344 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-01-20 04:46
New changeset 350b8e109c42 by Berker Peksag in branch '3.4':
Issue #22317: Document the action parameter in ArgumentParser.add_subparsers() docs.
https://hg.python.org/cpython/rev/350b8e109c42

New changeset 4709290253e3 by Berker Peksag in branch 'default':
Issue #22317: Document the action parameter in ArgumentParser.add_subparsers() docs.
https://hg.python.org/cpython/rev/4709290253e3
msg234346 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-01-20 04:55
New changeset 430236ef507b by Berker Peksag in branch '2.7':
Issue #22317: Document the action parameter in ArgumentParser.add_subparsers() docs.
https://hg.python.org/cpython/rev/430236ef507b
msg234347 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-01-20 04:56
Thanks for the patch, Mike.

Anne, thank you for the ticket triage! The only missing place was the ArgumentParser.add_subparsers() documentation: https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_subparsers
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66513
2015-01-20 04:56:55berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg234347

resolution: fixed
stage: needs patch -> resolved
2015-01-20 04:55:47python-devsetmessages: + msg234346
2015-01-20 04:46:45python-devsetnosy: + python-dev
messages: + msg234344
2015-01-19 01:31:34AnneTheAgilesetnosy: + AnneTheAgile
messages: + msg234296
2014-11-03 01:49:28Mike.Shortsetfiles: + argparse27.patch
2014-11-03 01:49:09Mike.Shortsetfiles: + argparse.patch
keywords: + patch
messages: + msg230527
2014-11-03 01:41:02Mike.Shortsetnosy: + Mike.Short
2014-11-02 16:01:57berker.peksagsetnosy: + paul.j3

versions: + Python 3.4, Python 3.5
2014-11-02 14:33:42ezio.melottisetkeywords: + easy
nosy: + bethard

type: enhancement
stage: needs patch
2014-08-31 20:39:23Ubikcreate