Programming languages
Python
A readable general-purpose language: web, data, automation and machine learning.
What it is
Guido van Rossum created Python, with a first release in 1991. It is dynamically typed, interpreted, and uses indentation instead of braces.
Its main strength is the ecosystem: NumPy, pandas, PyTorch and scikit-learn for data and ML, Django, FastAPI and Flask for the web, Ansible and scripts for automation. Packages are installed with pip or uv.
The reference implementation CPython is developed by the community under the Python Software Foundation. Changes go through PEPs. It is slower than compiled languages, but heavy computation is usually pushed into C extensions.
Use it when
- Data, analytics, ML and AI: nearly every library lands here first.
- Automation scripts, scraping, DevOps tooling.
- A backend on Django or FastAPI when development speed matters.
- Learning to program: simple syntax.
Avoid it when
- Services with strict latency and per-core throughput needs: Go, Rust and Java are faster.
- Mobile apps and browser frontends.
- Large codebases without type hints and tests: dynamic typing makes refactoring harder.
Key concepts
- GIL
- Global Interpreter Lock: in standard CPython only one thread runs bytecode at a time. For CPU work use processes.
- Virtual environment
- An isolated environment with its own packages per project (
venv,uv). - Type hints
- Optional type annotations checked by mypy or pyright. Not enforced at runtime.
- Generators
- Functions with
yieldreturn values one by one without holding the whole collection in memory. - Decorators
- Functions that wrap other functions: logging, caching, authorization.
Example
Cheat sheet
| Command or code | What it does |
|---|---|
python -m venv .venv | Creates a virtual environment |
source .venv/bin/activate | Activates the environment |
pip install requests | Installs a package |
[x * 2 for x in nums if x > 0] | List comprehension with a filter |
{k: v for k, v in pairs} | Dict comprehension |
with open('f.txt') as f: | Safe file opening |
def f(a, *args, **kwargs): | Arbitrary positional and keyword arguments |
f'{name}: {value:.2f}' | f-string with formatting |
for i, x in enumerate(items): | Loop with an index |
python -m pytest -q | Runs the tests |
How to learn it
- Install Python 3 and take the Python essentials course on ShortLesson.
- Learn basic types, conditions, loops, functions and string handling.
- Study lists, dicts, sets and list comprehensions.
- Learn to read and write files, work with JSON and handle exceptions.
- Work in a virtual environment: venv and pip, then uv.
- Build a small CLI or script that automates something in your own life.
- Add OOP, modules and tests with pytest.
- Pick a direction: web with FastAPI or Django, data, or automation.
Interview questions
1. What is the GIL?
The Global Interpreter Lock lets only one thread run Python bytecode at a time in CPython. So threads do not speed up CPU-bound tasks, and multiprocessing is used instead. For I/O, threads and asyncio work well.
2. How does a list differ from a tuple?
A list is mutable, a tuple is immutable. A tuple can be a dict key and is slightly lighter. Tuples suit fixed records.
3. What is a decorator?
A function that takes a function and returns a new one, adding behavior such as caching, logging or permission checks. It is written as
@decoratorabove the definition.4. What are generators for?
They produce values lazily, one at a time, with
yield. That saves memory on large data streams, for example when reading a big file.
Related technologies
- DjangoA batteries-included Python framework: ORM, admin, auth and templates.
- FastAPIA modern Python API framework built on type hints, with automatic validation and OpenAPI docs.
- FlaskA Python microframework: a minimal core with routing and templates, the rest through extensions.
- pytestPython's main testing framework: plain asserts, fixtures and parametrization.
Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).