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

Skip to content

Commit 3288e94

Browse files
committed
Merge #10423: clarify options vs args in argparse discussion of optparse
Patch by Sandro Tosi.
2 parents 1ff50df + 5e0c571 commit 3288e94

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Doc/library/argparse.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,9 +1852,10 @@ A partial upgrade path from :mod:`optparse` to :mod:`argparse`:
18521852
* Replace all :meth:`optparse.OptionParser.add_option` calls with
18531853
:meth:`ArgumentParser.add_argument` calls.
18541854

1855-
* Replace ``options, args = parser.parse_args()`` with ``args =
1855+
* Replace ``(options, args) = parser.parse_args()`` with ``args =
18561856
parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument`
1857-
calls for the positional arguments.
1857+
calls for the positional arguments. Keep in mind that what was previously
1858+
called ``options``, now in :mod:`argparse` context is called ``args``.
18581859

18591860
* Replace callback actions and the ``callback_*`` keyword arguments with
18601861
``type`` or ``action`` arguments.

0 commit comments

Comments
 (0)