Download presentation
Presentation is loading. Please wait.
Published byBrita Danielsen Modified over 5 years ago
1
EN.540.635 - Software Carpentry
Python – A Crash Course Esoteric Sections Compiled Languages
2
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!
3
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).
4
Programming Languages
5
Compiled Languages
6
Hello World - Python
7
Hello World - C Include I/O Functions Start your Main Function
Print to Screen End the Function
8
Hello World – C++
9
96 line object file
10
3896 line binary file
11
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
14
Python vs C vs C++ Python C C++
15
Python vs C vs C++ Python C and C++
16
Python vs C vs C++ Python C C++
17
Python vs C vs C++ Python C
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.