[Python-checkins] cpython (merge 3.4 -> default): Issue #17462: Add a paragraph about advantages of argparse over optparse.

berker.peksag python-checkins at python.org
Fri Sep 26 14:35:09 CEST 2014


https://hg.python.org/cpython/rev/45e1c0029aff
changeset:   92585:45e1c0029aff
parent:      92583:fd0c02c3df31
parent:      92584:84313c61e60d
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Fri Sep 26 15:35:02 2014 +0300
summary:
  Issue #17462: Add a paragraph about advantages of argparse over optparse.

Patch by Anastasia Filatova.

files:
  Doc/library/argparse.rst |  10 ++++++++++
  Misc/ACKS                |   1 +
  2 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1949,6 +1949,16 @@
 :mod:`optparse` had either been copy-pasted over or monkey-patched, it no
 longer seemed practical to try to maintain the backwards compatibility.
 
+The :mod:`argparse` module improves on the standard library :mod:`optparse`
+module in a number of ways including:
+
+* Handling positional arguments.
+* Supporting sub-commands.
+* Allowing alternative option prefixes like ``+`` and ``/``.
+* Handling zero-or-more and one-or-more style arguments.
+* Producing more informative usage messages.
+* Providing a much simpler interface for custom ``type`` and ``action``.
+
 A partial upgrade path from :mod:`optparse` to :mod:`argparse`:
 
 * Replace all :meth:`optparse.OptionParser.add_option` calls with
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -413,6 +413,7 @@
 John Feuerstein
 Carl Feynman
 Vincent Fiack
+Anastasia Filatova
 Tomer Filiba
 Jeffrey Finkelstein
 Russell Finn

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list