[issue9343] Document that argparse "parents" must be fully declared before children

New submission from Steven Bethard <steven.bethard@gmail.com>: [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
---------- assignee: docs@python components: Documentation messages: 111306 nosy: bethard, docs@python priority: normal severity: normal status: open title: Document that argparse "parents" must be fully declared before children versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue9343> _______________________________________

Éric Araujo <merwok@netwok.org> added the comment: 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. ---------- nosy: +merwok versions: -Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue9343> _______________________________________

Steven Bethard <steven.bethard@gmail.com> added the comment: Ah, thanks for the fix. No it doesn't need to go in 3.1 - argparse is only in 2.7 and 3.2. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue9343> _______________________________________

Roundup Robot <devnull@devnull> added the comment: 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 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue9343> _______________________________________

Steven Bethard <steven.bethard@gmail.com> added the comment: I added some documentation in the "parents" section of the argparse docs. ---------- assignee: docs@python -> bethard resolution: -> fixed stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue9343> _______________________________________
participants (3)
-
Roundup Robot
-
Steven Bethard
-
Éric Araujo