Skip to content

Undeprecate getopt and optparse #126180

Description

@serhiy-storchaka

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

Activity

  1. added 2 commits that reference this issue on Oct 30, 2024
  2. added
    type-featureA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directory
    docsDocumentation in the Doc dir
    and removed
    stdlibStandard Library Python modules in the Lib/ directory
    on Oct 30, 2024
  3. ncoghlan commented on Oct 31, 2024

    @ncoghlan
    Contributor

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

  4. added a commit that references this issue on Dec 23, 2024
  5. added a commit that references this issue on Dec 23, 2024
  6. added a commit that references this issue on Dec 23, 2024
  7. added a commit that references this issue on Dec 23, 2024
  8. added a commit that references this issue on Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions