Ask HN: Statically typed, high level language for machine learning?

3 points by snrji ↗ HN
Hi, I've been self-teaching machine learning the last few months. Python seems the only option, but I don't like dynamically typed languages. Python doesn't even have constructs for making a variable immutable.

Also, I think type hints aren't a in the right direction, comparing it with type inference and generics in Haskell, for instance.

Is there any alternative?

3 comments

[ 4.8 ms ] story [ 14.6 ms ] thread
Other languages won’t have as many high-quality libraries. Maybe something like MyPy?

http://mypy-lang.org

That's right, but imho type hints are no the way to go, specially when many types could actually be statically inferred by the compiler/interpreter.

Perhaps the solution would be a full blown programming language which transpiled to Python the same way Typescript does. So, MyPi, but much more developed: interfaces, type inference, generics... Having access to all the Python libraries.

> Python doesn't even have constructs for making a variable immutable.

recent addition into `typing_extensions` allows that:

from typing_extensions import Final immutable_str: Final[str] = "cant change me"

mypy will then notice you in case the variable has been changed somewhere.

> Also, I think type hints aren't a in the right direction, comparing it with type inference...

that's quite vague statement, but mypy supports type inference to some extent - if you'll initalize a list with some strings in it, it will infere the type as list of strings etc