Early previewThis guide is in development. Items tagged verify are still being checked against official docs.
nebx Learn
GitHub
Menu
Home/Python/Best practices
Py

Python

Readable, batteries-included, and the default language of AI.

Paradigm
Multi-paradigm, OOP, functional
Typing
Dynamic, strong, optional type hints
Memory
Reference counting + cycle GC
Runs
CPython bytecode interpreter
Concurrency
asyncio, threads (GIL), multiprocessing

Best practices

Habits experienced Python teams agree on.

PEP 8 with an automatic formatter

Ruff (lint + format) or Black keep style consistent.

Type-hint public code

Run mypy or pyright in CI; hints double as documentation.

One virtual environment per project

Pin dependencies in pyproject.toml plus a lock file.

pytest for tests

Plain assert statements, fixtures and parametrisation.

Prefer the standard library

pathlib, dataclasses, itertools, functools and collections solve many problems already.

Saved in this browser only. Part of Clean code foundations (0/5).