Skip to content

Who is the tool: the programmer or the program? #14280

Open
@hunterhogan

Description

@hunterhogan

I'm using typeshed_client to get the typeshed ast stub file, then I'm doing ast things to the file, and I am writing extra code to accommodate these three things

typeshed/stdlib/ast.pyi

Lines 1495 to 1498 in ecd5141

# Without the alias, Pyright complains variables named pattern are recursively defined
_Pattern: typing_extensions.TypeAlias = pattern

typeshed/stdlib/ast.pyi

Lines 1196 to 1199 in ecd5141

_Slice: typing_extensions.TypeAlias = expr
_SliceAttributes: typing_extensions.TypeAlias = _Attributes

which made me wonder: ought we disfigure a universal tool (Python's official stub file) because of a third-party validator's error?

Does the code validator serve the code writer, or do we write code to appease the code validator?

I believe a uniform, predictable stub file is better than coding around a false diagnostic report. I propose removing the three TypeAlias.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions