NumPy is more the 35% written in other languages how do they work internally?
-
1Extending and Embedding the Python InterpreterMechanic Pig– Mechanic Pig2022-07-30 14:06:29 +00:00Commented Jul 30, 2022 at 14:06
-
1Extending Python with C or C++.Some programmer dude– Some programmer dude2022-07-30 14:06:47 +00:00Commented Jul 30, 2022 at 14:06
-
1Python is written in C...oskar– oskar2022-07-30 14:07:04 +00:00Commented Jul 30, 2022 at 14:07
2 Answers
Python being an interpreted language, code written in it tends to be slow, because the interpreter needs to go through each line of the code being executed
because the performance is everything, modules are written in a lower level language like C which is then compiled to a shared object file. These files can be loaded by the Python interpreter and used like a normal python module. Because these modules are already compiled to machine code, they can be directly executed without going through the interpreter, and thus they are much faster than the equivalent code written in Python.
you can find a lot of modules written in c or c++ with extension .so