Python Key Characteristics and How Your Code Runs
Last updated on
What is Python
Python is a general purpose, interpreted programming language created by Guido Van Rossum in 1991.

It can run in any operating system, and it’s one of the most popular programming languages, mainly used for for machine learning, data science, automations, web backends, AI…
Key Characteristics
When thinking about Python in general you have to have this mental image in mind.

Python has 5 main characteristics that distinguish it
-
Interpreted: Code runs line-by-line through the Python interpreter, no compilation step is needed before running the program.
-
Dynamically typed: Since no compilation step is happening, variable types are resolved at runtime dynamically, so there is no need to declare them upfront, in contrast with other statically typed languages like C, C++ or Golang.
-
Garbage Collected: Python’s garbage collector manages the memory automatically for you, for example, when you declare a variable storing a list, you don’t have to think about freing it when it’s no longer used, Python’s garbage collector does that automatically for you.
-
Multi-paradigm: Python supports many programming styles such as procedural, functional (FP), object orriented programming (OOP)…
-
Batteries included: Python ships with a large standard library, it includes anything that you may need from basic math utils to advanced collections such as Minimum heaps and queues.
How Your Code runs

When you run:
python3 hello.py # or python hello.py
The Python’s interpreter first reads and parses your code.
And then it compiles it to bytecode which is a compact, fast and optimized binary format of your code ,
After that, the interpreter executes it on the Cpython virtual machine (VM).
In order to optimize future runs of your scripts, the interpreter may save the bytecode of some parts of the script as “.pyc” binary files within a directory named “pycache”.
By default it saves the bytecode only for complex scripts that import multiple modules.
To enforce the compilation of our hello.py script run:
python3 -m py_compile hello.py # or python -m py_compile hello.py
-m Python’s CLI argument stands for module, here we are running the “hello.py” script using the pre-installed “py_compile” Python module.

Enjoyed this article?
I'm currently open to new roles — remote-first or international. If something resonated or you'd like to collaborate, I'd love to hear from you.
This article was originally published on https://sidaliassoul.com/blog/python-key-characteristics-and-how-your-code-runs/. It was written by a human and polished using grammar tools for clarity.