Python 5.7The video for this lesson is on its way.
Everything else is ready: study the parts, the key terms and the quiz below.
Python 5.7Code walkthrough7 parts
Formatting, Linting and Type Checking
Let tools find the mistakes a reader would otherwise have to find.
Loading your progress…Next: 6.1 Classes and Objects
In this lesson7 parts
- 01Problems a tool can find
- 02Formatting
- 03Linting
- 04Fixing what the linter finds
- 05Type checking
- 06Where tools mislead
- 07Recap, your challenge, and next
Key terms
The words this lesson introduces, each in one line. The module’s glossary collects them all.
- formatter
- A tool that rewrites code's layout, without changing what it does:
ruff format. - linter
- A tool that reads code for mistakes, without running it:
ruff check. - type checker
- A tool that checks every call and return against the type hints, without running the code: mypy.
Quiz 5 questions
Your first pick on each question is the one that counts, and a right one earns a coin. Getting one wrong here is how the lesson sticks.
Practice
Problems to solve in your own notebook. Each states the problem, not the steps: working out the steps is the exercise. Level A applies the lesson, B combines it with earlier ones, C stretches it.
Common mistakes
What you will see when it goes wrong, why it happens, and the fix.
Where it’s used
Where this lesson’s ideas turn up in real work.