by BiteCode_dev · 4y ago · 0 comments
Granted, the python typing system is very limited, and to get complete validation, you'll need more than types as python type hints can't express complex rules.
Also, as the articles mentions, the validation will occur at runtime, it can't in any way make sure the program is valid from mypy checks alone.
Still, it's really nice to define your input data types and contraints in one go.
There are libraries in these languages where you can get a compile error if you make a mistake in an SQL statement.
Also, Python technically has no typing system to speak of so your comment is kind of strange. Not to mention pattern matching, destructuring and other goodies that improve productivity.
Well that is a pretty tall order. Those languages probably have the most extensive type systems among the languages with significant use. But even so Python's type system has features that some of them don't have: for example Rust doesn't have structural subtyping.
> Also, Python technically has no typing system to speak of so your comment is kind of strange.
Python PEPs define the typing annotations and the typing rules for each annotation. That for me counts as a type system, despite the fact that there is not built in typechecker and you can run programs that you didn't type check.
> Not to mention pattern matching, destructuring and other goodies that improve productivity.
Python has pattern matching now: https://peps.python.org/pep-0636/