3 ms·
On a tangent, Python has a static type system. It's been a part of the language for years now. It works much better than TypeScript– I would say it's as flexibl
by crazypython 6y ago
On a tangent, Python has a static type system. It's been a part of the language for years now. It works much better than TypeScript– I would say it's as flexible as Haskell's type system while being extremely easy to use and catching many bugs.
def sum(a: int, b: int) -> int: ...
Unlike Ruby and JavaScript, Python is strongly typed. You can't add a string to a number, for example. Because it's strongly typed, it's much easier to add a type system. When I first started using the type system, it felt like it was always a part of the language, they just added a syntax and a checker. It doesn't restrain me from what I would otherwise normally do in the language like TypeScript or Flow does. It's a perfect fit.
- pmontra 6y ago"1" + 1 fails in Ruby too. It's as strongly typed as Python. Perl is the other dynamic language that allows that, maybe also PHP?
- deleted 6y ago[deleted]