4 ms·
You may be interested in https://en.wikipedia.org/wiki/Cython https://en.wikipedia.org/wiki/Cython which was a fork of Pyrex which dates back to the very early
by cb321 4y ago
You may be interested in https://en.wikipedia.org/wiki/Cython https://en.wikipedia.org/wiki/Cython which was a fork of Pyrex which dates back to the very early noughties. It is basically as you describe and even has a way to "bypass the GIL" in extension modules. There is also an easy way to create a "compiled script" using `--embed`. This is essentially a gradually typed system [1] like the Common Lisp `declare` facility. Cython even has a warning system to tell you what you forgot to declare, and an annotated HTML generator to highlight "more Python C API heavy" portions of your code.
Personally, I think going all the way to Nim [2] is more satisfying than a "gradually typed" system, though.
[1] https://en.wikipedia.org/wiki/Gradual_typing https://en.wikipedia.org/wiki/Gradual_typing
[2] https://nim-lang.org/ https://nim-lang.org/