Stage 1 · Lesson 5 of 10
Type hints
are labels that say what a function takes and returns, for example def find_user(user_id: int) -> User | None. Python itself ignores them when the code runs. Tools like mypy or Pyright check them for you, and your editor uses them to suggest code.
They matter more in backend work than almost anywhere. That is because and read them to check incoming requests and to write your automatically. Learn the built-in generic types such as list[str] and dict[str, int], the X | None form for a value that may be missing, TypedDict and . Add hints as you write, rather than bolting them on later.
Common trapassuming a hint enforces anything by itself: without a checker or a library like Pydantic, a wrong type passes silently.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Python Fundamentals
Design Gurus · Beginner · $50
Python basics in a sensible order: collections, functions, classes and modules
- CourseFreeCS50's Introduction to Programming with Python
Harvard University · Beginner
Free Harvard course with real problem sets, and it teaches unit tests early
Practise
Keep handy
Also worth your time
The DNS, TCP, TLS and HTTP steps behind every request your backend will handle