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: Document that argparse "parents" must be fully declared before children
Type: Stage: resolved
Components: Documentation Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: bethard Nosy List: bethard, docs@python, eric.araujo, python-dev
Priority: normal Keywords:

Created on 2010-07-23 12:57 by bethard, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg111306 - (view) Author: Steven Bethard (bethard) * (Python committer) Date: 2010-07-23 12:57
[From http://code.google.com/p/argparse/issues/detail?id=61]

It should be documented clearly that only the arguments present on the parent parser at the time ArgumentParser is called will be included in the parser.

>>> parent = argparse.ArgumentParser(add_help=False)
>>> child = argparse.ArgumentParser(parents=[parent])
>>> parent.add_argument('--foo', action='store_true')
>>> child.parse_args(['--foo'])
usage: [-h]
: error: unrecognized arguments: --foo
msg111307 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-23 13:02
I removed 3.3, since it currently means “won’t be done for 3.2, so note for later.” I don’t know if the report applies to 3.1 (doc fixes go into stable releases too), so I’m not adding it.
msg111308 - (view) Author: Steven Bethard (bethard) * (Python committer) Date: 2010-07-23 13:06
Ah, thanks for the fix. No it doesn't need to go in 3.1 - argparse is only in 2.7 and 3.2.
msg132272 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-26 20:52
New changeset d288666c1d58 by Steven Bethard in branch '3.2':
Issue #9343: Document that argparse parent parsers must be configured before their children.
http://hg.python.org/cpython/rev/d288666c1d58

New changeset 15e98607555d by Steven Bethard in branch '2.7':
Issue #9343: Document that argparse parent parsers must be configured before their children. (Merge from 3.2.)
http://hg.python.org/cpython/rev/15e98607555d

New changeset 8bdc20468cbc by Steven Bethard in branch 'default':
Issue #9343: Document that argparse parent parsers must be configured before their children. (Merge from 3.2.)
http://hg.python.org/cpython/rev/8bdc20468cbc
msg132273 - (view) Author: Steven Bethard (bethard) * (Python committer) Date: 2011-03-26 20:53
I added some documentation in the "parents" section of the argparse docs.
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53589
2011-03-26 20:53:27bethardsetstatus: open -> closed
messages: + msg132273

assignee: docs@python -> bethard
resolution: fixed
stage: resolved
2011-03-26 20:52:13python-devsetnosy: + python-dev
messages: + msg132272
2010-07-23 13:06:50bethardsetmessages: + msg111308
2010-07-23 13:02:11eric.araujosetnosy: + eric.araujo

messages: + msg111307
versions: - Python 3.3
2010-07-23 12:57:25bethardcreate