Twitter user @DanyX23:

TIL: pyright, the python type checking engine that is used by VS Code, has support for exhaustiveness checking for match statements with union types!

If you add the following to your pyproject.toml, you’ll get the attached warning

[tool.pyright] reportMatchNotExhaustive = true

  • mao@lemmy.sdf.orgOP
    link
    fedilink
    arrow-up
    2
    arrow-down
    2
    ·
    6 months ago

    I feel like Python is coming to its senses in the recent years, with releases focusing on typing constructs and the match statement. I think they’re on the path to be a great statically typed language, don’t you think?