# Python Level 10: Types & Modern Python

> Level 10: Types & Modern Python of the LoWisa Python course: Type Hints, Generics and Protocols, Static Type Checking. 3 lessons and 9 ideas, each explained in one line.

Types & Modern Python is level 10 of 17 of the [LoWisa Python course](/courses/python/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Type Hints

- **Annotations.** A **hint** like def total(items: list[Order]) -> Decimal documents intent that tools can actually check.
- **Optional and unions.** The form str | None says a value may be missing: and the checker forces you to **handle** the None branch.
- **Hints are not enforcement.** Hints do nothing at **runtime** by default: their power comes from static analysis reading them.

## Generics and Protocols

- **Generics.** A **generic** like list[str] or dict[str, int] names what is inside the container, not just the container.
- **TypeVar.** A **TypeVar** links types across a signature: first(items: list[T]) -> T promises it returns the same kind it took.
- **Protocols.** A **Protocol** declares structural typing: anything with the right methods matches, duck typing made checkable.

## Static Type Checking

- **Running a checker.** A checker like **mypy** reads hints across the whole codebase and reports contradictions before anything runs.
- **Gradual typing.** Typing is **gradual**: annotate the core and the boundaries first, and let coverage grow with the code.
- **Types as design pressure.** Hard-to-type code is usually hard-to-reason code: the checker’s complaints are **design** feedback.

## Before and after this level

- **Before:** [Level 9: Iteration & Pythonic Design](/courses/python/level-9-iteration-and-pythonic-design/): Iterators and Generators, Context Managers, Decorators and Reusable Behaviour.
- **Next:** [Level 11: Concurrency](/courses/python/level-11-concurrency/): Threads and Processes, asyncio and Async Programming, Choosing the Right Concurrency Model.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Python Level 10: Types & Modern Python cover?

Type Hints, Generics and Protocols, Static Type Checking: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 9: Iteration & Pythonic Design, which covers Iterators and Generators, Context Managers, Decorators and Reusable Behaviour.

## Learn Python on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/python/level-10-types-and-modern-python/ · Updated 2026-11-16
