> something like type-safe Python similar to TypeScript
That already exists, and van Rossum worked on it: http://mypy-lang.org/
Also Pyre [0] by Facebook and Pytype [1] by Google. More importantly, the core part (type annotations) allowing these libraries to exist has been added to core python for years now and keeps on evolving, so it is an ongoing effort.
EDIT: As mentioned below, also added Pyright [2] by Microsoft
[0] https://github.com/facebook/pyre-check
You forgot the one made by Microsoft, Pyright (and PyLance).
Having tried a good number of these various type checkers, it seems like Pyright is the only one that properly supports all of the accepted PEP changes to typing.
Isn't that just F#?
Re:Guido van Rossum joins Microsoft
by estomagordo on Thursday November 12, 2020 @12:42PM
(#25072365)
In the sense that indentation has syntactical meaning, yes. Otherwise, no no no.
I don't understand. You can take Python code and basically write the equivalent in F#, ignoring many of F#'s additional features. It would look similar (probably even be cleaner) and would be type-safe.
Re:Guido van Rossum joins Microsoft
by augusto-moura on Thursday November 12, 2020 @12:47PM
(#25072438)
F# is not even close of Python, they are very distinct
Of course, one is a sanely designed language. :)
Joking aside, my question centered around that if one wants a type-safe Python, why wouldn't you just want something similar to F#?
Re:Guido van Rossum joins Microsoft
by augusto-moura on Thursday November 12, 2020 @02:45PM
(#25074020)
This is the same as asking for typed JS and getting Rust recommended just because the syntax is similar.
They are totally different, the core paradigm of programming is totally changed and most of the points of JS are not in Rust (meta-programming, garbage collection, community)
You can add typing to an existing codebase, saving you vast amounts of work compared to rewriting in a different language.
Can that really be done for Python and the vast amount of libraries? I don't get the sense that one could simply slap on a static type system on Python and get libraries typed for free.
That is unless we're talking about a gradual typing system for Python, where new Python code could be typed and integrated into untyped codebases, similar to Racket and Typed Racket.
The existing type system (see e.g. http://mypy-lang.org/) is gradual. You can mix typed and untyped code, at the cost of some safety.
You can also write type stubs for libraries that don't provide type information.
Re:Guido van Rossum joins Microsoft
by justanotheratom on Thursday November 12, 2020 @08:46PM
(#25077886)
Agree: F# as a better Python
Anyway, congrats to both MS and Anders! This will be very interesting for Python.