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 thread.
View all comments View context
5 points

I write Python and Typescript with full typing for my day job, and it’s pretty nice. Here’s the general workflow:

  1. Add some code without typing
  2. Iterate on 1 until it works properly
  3. Add tests and types
  4. Submit code for review

In development I get the benefit of most of the types being specified, but I don’t need to specify everything until I’m done. I much prefer Python to Typescript, but my hands are tied on the FE.

If I needed better performance though, I’d write in Rust, which is actually what I use for most of my hobby projects.

permalink
report
parent
reply

Python

!python@programming.dev

Create post

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

📅 Events
October 2023
November 2023
Past

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
  • Pythörhead: a Python library for interacting with Lemmy
  • Plemmy: a Python package for accessing the Lemmy API
  • pylemmy pylemmy enables simple access to Lemmy’s API with Python
  • mastodon.py, a Python wrapper for the Mastodon API
Feeds

Community stats

  • 503

    Monthly active users

  • 396

    Posts

  • 1.9K

    Comments