This is the first blog on Python for fintch professionals.
An Introduction to Python Language
Python is a high-level programming language, meaning it is designed to be easy for humans to read and write, while still allowing computers to execute the programs.
Programs written in high-level languages like Python can be transformed into machine language through compilation and interpretation.
Compilation
The source code is translated once into machine language (ML).
Benefits of Compilation:
- Faster execution of the translated code.
- The end user does not need the compiler to run the program.
- The translated code is stored in machine language, making it more difficult to copy the underlying programming logic.
Drawbacks of Compilation:
- The compilation process can be time-consuming, and each change to the source code requires the entire code to be recompiled.
- Compilation is necessary for each platform on which the program is intended to run.
Interpretation
The source code is translated each time it is run.
Benefits of Interpretation:
- Any changes to the code can be executed immediately without recompilation.
- Code can run on computers with different machine languages without the need for separate compilation for each architecture.
Drawbacks of Interpretation:
- Execution speed is slower, as the source code is translated at runtime.
- An interpreter must be installed on the end user's computer.
Interpreted languages are often referred to as scripting languages, and their source code is commonly called scripts. Python is classified as a scripting language.
Very few programming languages can be both compiled and interpreted; typically, a language is either one or the other.
Basics of Python
- Python is case sensitive.
- A single line must not contain more than one function; however, functions can be nested.
- Python is very particular about proper indentation.