Re:Python 3 Types in the Wild: A Tale of Two Type Systems [pdf]
by lmm on Sunday April 18, 2021 @10:34PM
(#26858634)
> You have to do this anyway; static typing doesn't write your code for you.
The amount is what matters. If spending x minutes writing down types saves you y minutes of thinking, and y>x, that's a win.
> Code that has type annotations has this same problem. That was the point of my response: static typing != sound code.
Well-typed code has certain soundness properties - they may not fully encode all the properties you want your program to have (that part is up to you), but the properties that you have encoded will be reliable. Optional typing undermines that: even if the types say one thing, you have no guarantee that that thing is true.
> They can't be incorrect if they aren't there. The comparison I'm making is not between code with correct type annotations and code with incorrect ones. It's between code with type annotations and code without any of them at all.
My point is that if the ecosystem is not well-typed then you don't actually have the choice of using types. What I'm arguing against is your claim that Python gives you the choice: it doesn't, because to be able to write well-typed code you need well-typed libraries.
The amount is what matters. If spending x minutes writing down types saves you y minutes of thinking, and y>x, that's a win.
> Code that has type annotations has this same problem. That was the point of my response: static typing != sound code.
Well-typed code has certain soundness properties - they may not fully encode all the properties you want your program to have (that part is up to you), but the properties that you have encoded will be reliable. Optional typing undermines that: even if the types say one thing, you have no guarantee that that thing is true.
> They can't be incorrect if they aren't there. The comparison I'm making is not between code with correct type annotations and code with incorrect ones. It's between code with type annotations and code without any of them at all.
My point is that if the ecosystem is not well-typed then you don't actually have the choice of using types. What I'm arguing against is your claim that Python gives you the choice: it doesn't, because to be able to write well-typed code you need well-typed libraries.