Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f6355f

Browse files
committed
Issue #17462: Add a paragraph about advantages of argparse over optparse.
Patch by Anastasia Filatova.
2 parents 1f3d0fd + 6c1f0ad commit 4f6355f

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Doc/library/argparse.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,16 @@ transparently, particularly with the changes required to support the new
19491949
:mod:`optparse` had either been copy-pasted over or monkey-patched, it no
19501950
longer seemed practical to try to maintain the backwards compatibility.
19511951

1952+
The :mod:`argparse` module improves on the standard library :mod:`optparse`
1953+
module in a number of ways including:
1954+
1955+
* Handling positional arguments.
1956+
* Supporting sub-commands.
1957+
* Allowing alternative option prefixes like ``+`` and ``/``.
1958+
* Handling zero-or-more and one-or-more style arguments.
1959+
* Producing more informative usage messages.
1960+
* Providing a much simpler interface for custom ``type`` and ``action``.
1961+
19521962
A partial upgrade path from :mod:`optparse` to :mod:`argparse`:
19531963

19541964
* Replace all :meth:`optparse.OptionParser.add_option` calls with

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ Florian Festi
413413
John Feuerstein
414414
Carl Feynman
415415
Vincent Fiack
416+
Anastasia Filatova
416417
Tomer Filiba
417418
Jeffrey Finkelstein
418419
Russell Finn

0 commit comments

Comments
 (0)