Skip to content

Explicit stripping strategies for leading and trailing whitespace #19

@grahamcracker1234

Description

@grahamcracker1234

Would allowing for specifying the strip strategy for each end of the input be useful? We could allow for the following:

StripOption = Literal["smart", "all", "none"]

def dedent(  # pyright: ignore[reportUnreachable]
    string: Template | LiteralString,
    /,
    *,
    align: bool | Missing = MISSING,
    strip: StripOption | tuple[StripOption, StripOption] | Missing = MISSING,
) -> str: ...

This would allow a user to specify a different strategy such as ["smart", "all"] for applying the smart strategy to the beginning of the string, and the all strategy to the end.

It's unclear how actually useful this is or if user's would even use it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-feedbackAwaiting feedback, review, or direction from maintainers or communitystatus:explorationEarly-stage work: exploring approach, feasibility, or design.type:featureIntroduces a new capability or functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions