Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d186f99

Browse files
committed
Issue #9343: Document that argparse parent parsers must be configured before their children.
1 parent d8ad68f commit d186f99

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/library/argparse.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@ Note that most parent parsers will specify ``add_help=False``. Otherwise, the
351351
:class:`ArgumentParser` will see two ``-h/--help`` options (one in the parent
352352
and one in the child) and raise an error.
353353

354+
.. note::
355+
You must fully initialize the parsers before passing them via ``parents=``.
356+
If you change the parent parsers after the child parser, those changes will
357+
not be reflected in the child.
358+
354359

355360
formatter_class
356361
^^^^^^^^^^^^^^^

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ Library
162162

163163
- Issue #8982: Improve the documentation for the argparse Namespace object.
164164

165+
- Issue #9343: Document that argparse parent parsers must be configured before
166+
their children.
167+
165168
Build
166169
-----
167170

0 commit comments

Comments
 (0)