Kaydet (Commit) 3288e948 authored tarafından R David Murray's avatar R David Murray

Merge #10423: clarify options vs args in argparse discussion of optparse

Patch by Sandro Tosi.
......@@ -1852,9 +1852,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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment