Courses
Python Advanced: Code That Scales Past Your Own Laptop
Check Yourself: Functions That Wrap Functions
Five scenario questions on closures and decorators. If you miss more than one, reread the two lessons before moving on.
Course content
Join this Course
Sign in to save your progress.
-
Functions That Wrap Functions
-
Python Closures: Functions That Remember
-
Python Decorators in Real Code: Timing, Retry and Logging
-
-
-
Data That Doesn't Fit in Memory
-
Python Iterators: What a for Loop Actually Does
-
Python Generators and yield: One Piece at a Time
-
Python Context Managers: Clean Up Even When Things Fail
-
-
-
Catch Bugs Before You Run the Code
-
Python Type Hints Beyond the Basics: Optional, Union, Generics
-
Checking Types With mypy in a Real Project
-
-
-
Doing More Than One Thing at a Time
-
Python Concurrency Basics: Threads, Processes or asyncio?
-
Python asyncio: Wait for Many Things Without Waiting Longer
-
-
-
Ship It, Then Make It Fast
-
Packaging a Python Project With pyproject.toml
-
Profiling Python Code: Measure Before You Optimize
-
-
- Final Check: Python Advanced
1.
make_vat(rate) returns an inner function that uses rate. After make_vat has finished, how does the inner function still know the rate?
2.
Your counter's inner function does count += 1 and fails with UnboundLocalError. What is the fix?
3.
You create three callbacks in a loop with lambda: handle(level), and all three handle the last level. Why?
4.
You decorate fetch_rates with your own decorator. Logs and test reports now call it "wrapper". What did you forget?
5.
You want to add @retry(attempts=3) to a function that charges a customer's card. What is the main risk?
About
Five scenario questions on closures and decorators. If you miss more than one, reread the two lessons before moving on.
- Duration
- 5 min
- Last update
- 09/01/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.