Screenshots are captured in a Docker container with a headless browser. Task: MIL-004#1 Task: MIL-004#2 Task: MIL-004#3 Task: MIL-004#4 Task: MIL-004#5
15 lines
743 B
Markdown
15 lines
743 B
Markdown
**English** · [Dansk](Lecture-4-Decorators-da) · [Bahasa Melayu](Lecture-4-Decorators-ms)
|
|
|
|
# Lecture 4: Decorators
|
|
|
|

|
|
|
|
Code: `src/higher_lower/presentation/lectures/step_04_decorators.py`.
|
|
|
|
## What we gained
|
|
|
|
- A decorator is a function that takes a function and returns a new function.
|
|
- `make_bold`, `make_emphasis` and `make_underlined` add `<b>`, `<em>` and `<u>` once, so no route repeats the tags.
|
|
- Decorators stack: the one nearest the function runs first.
|
|
- `functools.wraps` keeps the name of the function, which Flask needs for every route.
|