Are assignment expressions the only linguistic change? For years,I've been holding my breath in Python for sum types, totality checking, and an enforced, complete type system -- one where you can say "this should be a list of lists of integers" and it won't let you put any other kind of thing there. (Yes, there are external typing solutions like PyPy, but last I checked they did not offer complete type systems (you c…
> but not that it’s a list of ints Python type annotations do support such use case: List[int].
>>> def f (x:int) -> int: return x+1
...
>>> def g (x:str) -> str: return f(x)
...
>>> g(1)
2
I expected a complaint after the second definition: I specified that g takes and returns a string, and then defined it to take and return an int. Not only did Python not catch the error at compile time (defining g), it didn't even catch it at runtime (calling g).