05
Languages / Beginner → intermediate
Python application development
Python fundamentals, type hints, modules, virtual environments, data structures, exceptions, and application organization.
01Pythonic foundations
Python emphasizes readability and a large standard library. Dynamic typing keeps code concise, while type hints help editors, reviewers, and static analysis understand intended values.
pythonTyped, testable business logic
from dataclasses import dataclass
@dataclass(frozen=True)
class Item:
name: str
price: float
def total(items: list[Item]) -> float:
if any(item.price < 0 for item in items):
raise ValueError("price cannot be negative")
return sum(item.price for item in items)
02Project environment
bashVirtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
python -m pip install -U pip
pip install -r requirements.txt
03Application structure
- Keep configuration separate from secrets.
- Put reusable business logic outside route/UI functions.
- Use explicit database transactions for important state changes.
- Log exceptions with enough context to diagnose them, but never log passwords, tokens, or secret URLs.