3 ms·
Technically Python is now an optionally-typed language, as of version 3.5. It won't actually check the types out-of-the-box, but it has support for annotating v
by icebraining 9y ago
Technically Python is now an optionally-typed language, as of version 3.5. It won't actually check the types out-of-the-box, but it has support for annotating variables and functions with their types. A separate project (mypy) can then read and check those types, and it does some inference too.
You can see typed examples here: http://mypy-lang.org/examples.html http://mypy-lang.org/examples.html
- weberc2 9y agoIt's still a work in progress though. Buggy, unintuitive, and incomplete (e.g., no recursive types).
- camus2 9y ago> Technically Python is now an optionally-typed language, as of version 3.5 Well no, since the compiler isn't checking types and you need a third party tool for that. So it's not optional typing. PHP does have run-time optional typing and was successful at retrofitting a static type system in a completely dynamic language. Mypy is just a static analysis tool.
- icebraining 9y agoFine, but it's just an import away: https://github.com/kislyuk/ensure https://github.com/kislyuk/ensure (written by HN user ak217)
- whyever 9y agoIt does not help you as much if the standard library and the whole ecosystem don't have type annotations.