EN.540.635 - Software Carpentry Python – A Crash Course Esoteric Sections Compiled Languages
How does Python Work? Code gets written (in a .py file or the command line). On execution (running the code), it gets parsed, verifying syntax and code. Finally, the python interpreter is called, running your code. How does the interpreter work? It runs pre-compiled functions!
So why is Python Slow? Python must parse code before running it. Python must interpret code when running it. To get around (1), a .pyc is generated when a function is imported. The .pyc is compiled python code! Due to being a scripting language, it is not possible to do away with (2).
Programming Languages
Compiled Languages
Hello World - Python
Hello World - C Include I/O Functions Start your Main Function Print to Screen End the Function
Hello World – C++
96 line object file
3896 line binary file
How To Compile? Have the compiler/linker installed ( gcc and g++ ) Compile using the following command: gcc –c hello.c This generates the hello.o object file. Now, link the object file into an executable: gcc –o hello hello.o Now, you can run the code hello.exe
Python vs C vs C++ Python C C++
Python vs C vs C++ Python C and C++
Python vs C vs C++ Python C C++
Python vs C vs C++ Python C