| I'm sorry if it sounded that way, I'm just bored of this topic. I spent most of my 20s researching and debating on it. I have a much more pragmatic approach now. Regarding Python, I didn't even want to mention it because it'd not be fair. I could point out the shortcoming on Python type annotations:
- Completely unsound (you can use `Any` everywhere)
- lack of type-level evaluations: a `match` can't be type-annotated
- Lack of variance expressiveness: can't declare variance on methods for example
- etc... But the answer regarding Python's type annotations shortcomings is basically "all of them", because it was not designed to be a statically typed language. And regarding your question: "Do they provide extra safety and value?" Sadly, it's not a yes/no answer. The answer is "it depends". For example, a method defined as `sum(l: List[Int])` cannot express if it works with an empty list, and depends on the value passed at runtime. But in Lean you can define: def sum (xs : Array Int) (_ : xs.size > 0) : Int :=
So the following expression doesn't even compile: #eval sum #[]
And funny enough, the research behind this is called "Dependent type research" [0].But again, my approach now is a lot more pragmatic. Similar to your question, mine is: can I break down this piece of software in very clearly defined contracts and layers and make it blow up at compile time if anybody violates these constraints or encapsulation? If the answer is "Yes", that's good with me. Python qualifies, Typescript qualifies (although I hate its type system more than python's, etc). [0] https://en.wikipedia.org/wiki/Dependent_type |