Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Wording tweaks
  • Loading branch information
ncoghlan committed Oct 31, 2024
commit 0a568f145f44148873ce7bf3a57b24cad3efbb02
2 changes: 1 addition & 1 deletion Doc/howto/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ recommended command-line parsing module in the Python standard library.

There are two other modules that fulfill the same task, namely
:mod:`getopt` (an equivalent for ``getopt()`` from the C
language) and the deprecated :mod:`optparse`.
language) and the lower level :mod:`optparse` module.
Note also that :mod:`argparse` is based on :mod:`optparse`,
and therefore very similar in terms of usage.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
While :mod:`argparse` is the recommended standard library module for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not recommend it for now. You can use it on your own risk. optparse may need more work, but it works as expected. I would recommend it for beginners, which cannot distinguish their own errors from peculiarities of the library.

Copy link
Contributor Author

@ncoghlan ncoghlan Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this PR, I'd like to stick with the status quo as far as recommendations go (that is, only taking the step back from "argparse is the only non-deprecated argument processing option in the standard library").

Taking the extra step to saying "argparse is not recommended over optparse anymore, even for end user applications" would then be a separate follow up question.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Keep the argparse recommendation. We're not going to dis-recommend the most widely used Python argument parsing library in the world (that causes churn and angst from users). Nor are we going to be adding yet another one to the stdlib in the future. argparse supports most users quite well, "warts" and all, with plenty of popular third party options for yet other behaviors beyond our stdlib options.

*implementing* command line applications, authors of third party
command line argument processing libraries may find that the
simpler :mod:`optparse` module serves as a better foundation for
lower level :mod:`optparse` module serves as a better foundation for
that use case.

--------------
Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1655,8 +1655,8 @@ optparse
While :mod:`argparse` remains preferred for new projects that
aren't using a third party command line argument processing
library, there are aspects of the way ``argparse`` works that
means ``optparse`` may provide a better foundation for *writing*
argument processing libraries.
means the lower level ``optparse`` module may provide a better
foundation for *writing* argument processing libraries.
(Contributed by Alyssa Coghlan in :gh:`126225`.)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ There are legitimate reasons to use one of these modules in preference to
:mod:`argparse`, and none of these modules are at risk of being removed
from the standard library. Of the three, ``argparse`` remains the
recommended default choice, *unless* one of the concerns noted at the top of
the module documentation applies.
the ``optparse`` module documentation applies.