Skip to content

Use new sentinel class for argparse.SUPPRESS #149149

@jonathandung

Description

@jonathandung

Feature or enhancement

Proposal:

argparse.SUPPRESS is currently a string but only used in identity comparisons. Though it does get a pretty string representation this way, this is unidiomatic python and causes the constant to have unintended string methods.

I propose to wrap it in a PEP 661 sentinel:

SUPPRESS = sentinel('SUPPRESS')

as opposed to the current:

SUPPRESS = '==SUPPRESS=='

This is a breaking change and may require some discussion. Feedback is much appreciated.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Status

    Doc issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions