[Python-checkins] cpython (2.7): #10423: clarify options vs args in argparse discussion of optparse

r.david.murray python-checkins at python.org
Sat Mar 31 00:09:41 CEST 2012


http://hg.python.org/cpython/rev/cb5214e6c287
changeset: 76001:cb5214e6c287
branch: 2.7
parent: 75996:5aad56eb471c
user: R David Murray <rdmurray at bitdance.com>
date: Fri Mar 30 18:09:07 2012 -0400
summary:
 #10423: clarify options vs args in argparse discussion of optparse
Patch by Sandro Tosi.
files:
 Doc/library/argparse.rst | 5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1826,9 +1826,10 @@
 * 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.
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /