-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143984: Improve Lib/test/test_decimal.py CLI with argparse #143983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
…mal.py The optparse module is deprecated since Python 3.2. This change migrates Lib/test/test_decimal.py to use the argparse module for command line argument parsing. This involves: - Importing argparse instead of optparse. - Using ArgumentParser instead of OptionParser. - Updating argument definitions (add_argument). - Escaping '%' characters in help strings. - Updating execution logic to use the argparse Namespace object.
24d59b9 to
5fee791
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Misc/NEWS.d/next/Tests/2026-01-18-05-42-41.gh-issue-143984.n1imyc.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Hugo van Kemenade <[email protected]>
…myc.rst Co-authored-by: Hugo van Kemenade <[email protected]>
ZeroIntensity
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am very concerned that this will inspire copycat PRs. optparse is not deprecated, so apart from "this isn't optparse", what's the benefit of switching?
|
argparse has a better user experience with mutually exclusive groups and colour help. |
|
Ok, that's fine. I think we should be clearer about that in the issue and news entry. So, instead of saying "replaced |
|
Updated the NEWS entry and PR description to highlight the improvements in help output (colorized help, better grouping). Thanks! |
Description
This change improves the command-line interface experience, including support for colorized help output and better grouping of arguments.
Verification
python Lib/test/test_decimal.py --helppython Lib/test/test_decimal.py --skip