Skip to content
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

Undeprecate getopt and optparse #126180

Open
serhiy-storchaka opened this issue Oct 30, 2024 · 1 comment
Open

Undeprecate getopt and optparse #126180

serhiy-storchaka opened this issue Oct 30, 2024 · 1 comment
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Oct 30, 2024

See discussion at https://discuss.python.org/t/getopt-and-optparse-vs-argparse/69618. Seems that all support this.

argparse has many issues, some are fundamental and cannot be easily worked around. Its implements behavior different from the behavior of other Unix/Linux programs in subtle ways. It is still not mature to be the preferable Python module for CLI.

getopt is a de-facto cross-language standard. Many programmers that came from other programming languges are already familiar with it. It is very simple, so even if there are other CLI modules, it should be left in the stdlib.

optparse provides an object-oriented interface. Even if it has less features than argparse, it is more stable and has less bugs. It should be the preferable Python module for CLI.

Linked PRs

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 30, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 30, 2024
@picnixz picnixz added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Oct 30, 2024
@picnixz picnixz added docs Documentation in the Doc dir and removed stdlib Python modules in the Lib dir labels Oct 30, 2024
@ncoghlan
Copy link
Contributor

I missed that @serhiy-storchaka had already created a PR for this, so #126227 is an alternative take on the same change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement
Projects
Status: Todo
Development

No branches or pull requests

3 participants