mirror of
https://github.com/python/cpython.git
synced 2025-12-10 02:50:09 +00:00
Issue #17462: Add a paragraph about advantages of argparse over optparse.
Patch by Anastasia Filatova.
This commit is contained in:
parent
d5a8f5807f
commit
6c1f0ad665
2 changed files with 11 additions and 0 deletions
|
|
@ -1949,6 +1949,16 @@ transparently, particularly with the changes required to support the new
|
||||||
:mod:`optparse` had either been copy-pasted over or monkey-patched, it no
|
:mod:`optparse` had either been copy-pasted over or monkey-patched, it no
|
||||||
longer seemed practical to try to maintain the backwards compatibility.
|
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`:
|
A partial upgrade path from :mod:`optparse` to :mod:`argparse`:
|
||||||
|
|
||||||
* Replace all :meth:`optparse.OptionParser.add_option` calls with
|
* Replace all :meth:`optparse.OptionParser.add_option` calls with
|
||||||
|
|
|
||||||
|
|
@ -411,6 +411,7 @@ Florian Festi
|
||||||
John Feuerstein
|
John Feuerstein
|
||||||
Carl Feynman
|
Carl Feynman
|
||||||
Vincent Fiack
|
Vincent Fiack
|
||||||
|
Anastasia Filatova
|
||||||
Tomer Filiba
|
Tomer Filiba
|
||||||
Jeffrey Finkelstein
|
Jeffrey Finkelstein
|
||||||
Russell Finn
|
Russell Finn
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue