pythoninterpretercompiled

why do people say python is slow because it is interpreted? It has .pyc files


Why don't people just use the compiled python file whenever they need optimization? Then the code won't have to be interpereted then compiled.

Is there something I am missing? It seems to me like a simple problem.


Solution

  • I believe this is enough to correct your misunderstanding.

    A program doesn’t run any faster when it is read from a .pyc or .pyo file than when it is read from a .py file; the only thing that’s faster about .pyc or .pyo files is the speed with which they are loaded.

    source : https://docs.python.org/2/tutorial/modules.html#packages