82
submitted 6 months ago by mao@lemmy.sdf.org to c/python@programming.dev

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

you are viewing a single comment's thread
view the rest of the comments
[-] FizzyOrange@programming.dev 4 points 6 months ago

It also does exhaustiveness checking for enums! Pyright is probably the best thing about Python.

this post was submitted on 23 Apr 2024
82 points (100.0% liked)

Python

6339 readers
3 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS