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.
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.
pyc files are created by the Python interpreter when a . py file is imported. They contain the "compiled bytecode" of the imported module/program so that the "translation" from source code to bytecode (which only needs to be done once) can be skipped on subsequent imports if the . pyc is newer than the corresponding .
py files contain the source code of a program. Whereas, . pyc file contains the bytecode of your program.
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 ".
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With