Six lessons on the function-and-iteration layer. Eight questions, 80% to pass. The trick questions are about what @deco actually does at the syntax level, and what yield returns vs. what calling a generator function returns.
| Lesson | Concept | Key syntax |
|---|---|---|
| 8 | Functions as values | apply(fn, x, y) — pass functions as arguments |
| 9 | Decorators | @logged def f(): ... — f = logged(f) |
| 10 | Decorators with arguments | @repeat(times=3) — three nested layers |
| 11 | Generators | def f(): yield x — pause/resume on each value |
| 12 | Generator pipelines | chain — output of one is input of next |
| 13 | Custom context managers | @contextmanager def f(): try: yield x; finally: ... |
@deco is sugar for reassigning the name.next().with body, then runs teardown — even on exception.Six lessons on the function-and-iteration layer. Eight questions, 80% to pass. The trick questions are about what @deco actually does at the syntax level, and what yield returns vs. what calling a generator function returns.
| Lesson | Concept | Key syntax |
|---|---|---|
| 8 | Functions as values | apply(fn, x, y) — pass functions as arguments |
| 9 | Decorators | @logged def f(): ... — f = logged(f) |
| 10 | Decorators with arguments | @repeat(times=3) — three nested layers |
| 11 | Generators | def f(): yield x — pause/resume on each value |
| 12 | Generator pipelines | chain — output of one is input of next |
| 13 | Custom context managers | @contextmanager def f(): try: yield x; finally: ... |
@deco is sugar for reassigning the name.next().with body, then runs teardown — even on exception.Create a free account to get started. Paid plans unlock all tracks.