[docs] argparse FAQ: how it is different from optparse (issue 17462)
techtonik at gmail.com
techtonik at gmail.com
Tue Mar 18 13:39:15 CET 2014
Reviewers: ,
http://bugs.python.org/review/17462/diff/11350/Doc/library/argparse.rst
File Doc/library/argparse.rst (right):
http://bugs.python.org/review/17462/diff/11350/Doc/library/argparse.rst#newcode1892
Doc/library/argparse.rst:1892: * Providing a much simpler interface for
custom ``type`` and ``action``.
This info is copy/pasted from
http://stackoverflow.com/questions/3217673/why-use-argparse-rather-than-optparse
which is `cc by-sa 3.0 with attribution required`, so please consult on
core mailing list how to handle that.
Please review this at http://bugs.python.org/review/17462/
Affected files:
Doc/library/argparse.rst
diff -r 14c1ff6a8086 Doc/library/argparse.rst
--- a/Doc/library/argparse.rst Tue Mar 11 08:12:48 2014 +0100
+++ b/Doc/library/argparse.rst Tue Mar 18 12:22:01 2014 +0100
@@ -1915,6 +1915,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
More information about the docs
mailing list