To those who want to turn Python into Golang/Rust/Haskell/Java ... guys, other programming languages are available.
Anything to avoid the over complexity associated with delivering content with nodejs it’s like you missed out on building your computational foundation.
It’s common that as project grows larger and more unwieldy, people ask for more warranty and help from their tooling. I think Python position on this strikes a good balance - provide the infrastructure for adding type hint but delegates type checking to a third party.
There's packages to typecheck at runtime, even to check the parameters to a function.
As they are not enforced at runtime, you can easily return bollocks and not know.
I really like how c# does it, which is have strict typing on by default, but allowing you to turn it off for things where you're wanting to be loosey goosey. Not having to do a bunch of type checks on every operation would also speed up a bunch of things inside python
However, that would make it a different language. perhaps python 4? (ducks)
https://github.com/google/pytype https://github.com/google/pytype https://github.com/microsoft/pyright
By that I mean if you do
foo = {"a": 2}
foo["b"] = 3
you will get a type error because the inferred type of foo includes knowledge of the keys. But well written code doesn't use dicts when you know which keys are going to be present - you use a dataclass.I guess you could argue most Python is not well written, but then most Python developers are too amateur to use Pyright anyway.
Lisp compiles to native code since 1962, having a JIT is pretty much given.
I only mentioned Common Lisp, because of the wide library, having already the implementation experience of Lisp Machines from Xerox PARC, TI, Genera, and being as dynamic as Python if not more so, already to sidestep the usual dynamism excuse for lack of Python JIT's.
Compiling to native code isn't JIT, it was very common to run just straight interpreted code on the Lisp Machines (since compiling took a long time, and then to load the final file object on slow disks).
Feel free to show us the manuals of those implementations without a chapter about (compile ....), (disassemble ....) or similar.
The Lisp Machine compiler is incremental, but it is not a dynamic compiler, it never changes the compiled object when it has been compiled during run-time. This is similar with all Lisp implementations, and even Python. Code is also not compiled by default on the Lisp Machine, it is interpreted.
https://docs.python.org/3/library/functions.html#compile https://docs.python.org/3/library/dis.html
Python has all the building blocks that Lisp does in this regard, and has had for many many years. But I'm not allowed to quote the Lisp Machine manual on the topic, since it has chapters on the compiler so I'll jump out of this conversation now...
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec...
https://web.archive.org/web/20201213195043/ftp://publication...
Dynamic compilation (i.e. compilation during execution and/or modifying the emitted compiled output during run-time -- depending on which school one prefers) was never a thing on the Lisp Machine, and is not even a thing in modern Lisp implementations like say SBCL which just does static compilation (compiled object is never modified when it has been compiled).
(print-herald)
LM-3 System, band 4 of AMS-LISPM-2. (LM-3)
2048K physical memory, 16127K virtual memory.
Experimental System 300.0
Experimental Local-File 54.0
Microcode 323
AMS Lisp Machine Two, with associated machine FS.
(defun foo () "bar")
FOO
(compiled-function-p #'foo)
NIL"The earliest published JIT compiler is generally attributed to work on LISP by John McCarthy in 1960"
As for the LM-3 example, I would rather be proven wrong by you pointing me to PyPy as counter example, but the poor fellow not even for this comes up.
LISP I had an incremental compiler. The user calls the compiler with a list of functions or function definitions to compile. It's not compiling dynamic by the system and also does not use information about the running function (call statistics, call argument statistics, ...).
There is no "Just in Time" functionality provided. The developer is responsible to decide what code to compile and when to compile the code. A function needs to be compiled by the developer before it is invoked, otherwise it won't run compiled. In a JIT compiled setting the system decides when to compile the code: either on start or during runtime triggered by the system. The code will be "Just in Time" compiled.
This Wikipedia article explains the difference:
https://en.wikipedia.org/wiki/Dynamic_compilation
"Just-in-time compilation is a form of dynamic compilation."
"Unlike dynamic compilation, as defined above, incremental compilation does not involve further optimisations after the program is first run."
Later Lisp systems may have aspects of JIT compilation. For example some CLOS implementations optimize code (-> method combinations) at runtime, possibly via compilation.
"The earliest published JIT compiler is generally attributed to work on LISP by John McCarthy in 1960"
I can naturally also go hunthing for those papers from my digital cellar.