82
Pyright can check exhaustiveness of match statements on unions
(lemmy.sdf.org)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
I mean thats one of the big points of python and why you wanna use it in the first place.
I personally don't main python but to me this all seems like a effort to retrofit the language for use in large enterprise and web applications, something for which it honestly never should have been used this heavily in the first place. I guess the state of the world 10 years ago let to it, with .NET not officially being multiplat, Java being Java and Rust, Kotlin and Go being in their infancy.
To me Python always was a cool language to write small scripts to automate certain things. Something a single developer writes with < 10K LoC. Where than you can achieve the same thing with way less code and less hastle like setting up a seperate build tool
If your gonna go heavy on typing and error handling but don't want the complexity of a compiled language just use a .NET or JVM lang, honestly. They are fundamentally built around strong typing and use that information for much better performance and developer experience.
Or if you just want THE most flexible typesystem where you can specify types as broad or specific as possible typescript takes the cake.
I write Python and Typescript with full typing for my day job, and it's pretty nice. Here's the general workflow:
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.