Home Blog Resume Contact

Python Key Characteristics and How Your Code Runs

Sidali Assoul Sidali Assoul 2 min read

Last updated on

What is Python

Python is a general purpose, interpreted programming language created by Guido Van Rossum in 1991.

Python's author Guido van Rossum

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's Key Characteristics

Python has 5 main characteristics that distinguish it

  1. Interpreted: Code runs line-by-line through the Python interpreter, no compilation step is needed before running the program.

  2. 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.

  3. 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.

  4. Multi-paradigm: Python supports many programming styles such as procedural, functional (FP), object orriented programming (OOP)…

  5. 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

How Your Python 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.

Force Python to compile a basic hello.py script.

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.

Connect on LinkedIn
Sidali Assoul

Written by

Sidali Assoul

Software engineer with 5 years in full stack web and mobile development, a proven track record in data science, research, and modern AI solutions, with a business-first engineering mindset for shipping products that deliver real value.

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.