zenlotus / argparse

Automatically exported from code.google.com/p/argparse
Other
0 stars 0 forks source link

Document that parents must be fully declared before children. #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

>>> 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

What is the expected output? What do you see instead?

>>> child.parse_args(['--foo'])
Namespace(foo=True)

Please use labels and text to provide additional information.

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.

Original issue reported on code.google.com by steven.b...@gmail.com on 2 Mar 2010 at 7:51

GoogleCodeExporter commented 9 years ago
Moved to http://bugs.python.org/issue9343

Original comment by steven.b...@gmail.com on 23 Jul 2010 at 12:58