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

Skip to content

Commit b04d70d

Browse files
committed
Issue #9343: Document that argparse parent parsers must be configured before their children. (Merge from 3.2.)
2 parents ff5ee0c + d186f99 commit b04d70d

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
@@ -304,6 +304,9 @@ Library
304304

305305
- Issue #8982: Improve the documentation for the argparse Namespace object.
306306

307+
- Issue #9343: Document that argparse parent parsers must be configured before
308+
their children.
309+
307310
Build
308311
-----
309312

0 commit comments

Comments
 (0)