From: R David Murray Date: Fri, 30 Mar 2012 22:09:07 +0000 (-0400) Subject: #10423: clarify options vs args in argparse discussion of optparse X-Git-Tag: v2.7.4rc1~936 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5080cad6462128fcd3a71b1bc6a78ed890901e73;p=python #10423: clarify options vs args in argparse discussion of optparse Patch by Sandro Tosi. --- diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index bb7c88de9e..50a4533416 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1826,9 +1826,10 @@ A partial upgrade path from :mod:`optparse` to :mod:`argparse`: * Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:`ArgumentParser.add_argument` calls. -* Replace ``options, args = parser.parse_args()`` with ``args = +* Replace ``(options, args) = parser.parse_args()`` with ``args = parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` - calls for the positional arguments. + calls for the positional arguments. Keep in mind that what was previously + called ``options``, now in :mod:`argparse` context is called ``args``. * Replace callback actions and the ``callback_*`` keyword arguments with ``type`` or ``action`` arguments.