3 ms·
Python is strongly typed, and Python 3 annotations with tools like MyPy brings static type checks.
by caioariede 9y ago
Python is strongly typed, and Python 3 annotations with tools like MyPy brings static type checks.
- scrollaway 9y agoHave you used MyPy? I'm currently looking to adopt it, but the feedback I've been getting is that it's a lot more painful to use than Typescript (which imho sets the gold standard of "optional typing").
- joshuamorton 9y agoI haven't used typescript, but I have used MyPy (Or, more accurately, pytype), and its absolutely a joy to work with. I've also used closure (the JS type system that isn't TypeScript) and I prefer pytype, fwiw. My only complaint about Pytype is that there's no `Char` type at compile time (ie `for x in "a string"` -> Iterable[Char] instead of Iterable[str] during typechecking). But alas.
- mcypher 9y agoUnfortunately, MyPy doesn't work well with libraries or third party packages and treats external objects as `ANY` type. You can work around this with stubs but it's not fun writing type annotations for third party objects / functions. typeshed exists for the standard library and various popular third party libraries[1] to solve this very problem. [1] https://github.com/python/typeshed https://github.com/python/typeshed