All about decorators
summary
Shows exactly what gets built and what works: writes a bunch of decorators that wrap functions, uses splat args and double-splat kwargs so wrappers accept any signature, demonstrates functools.wraps to preserve names, uses nonlocal counter storage for per-decorator state, implements memoize and a timing logger that appends to timing.txt, a once-per-minute gate that raises an error when called too soon, and class decoration that stamps instances with creation time — all examples run live and produce the promised files and outputs.
AI-written summary · about
chapters (11)
- 0:00Introduction and setup
- 5:23Understanding decorators
- 15:54Applying decorator syntax
- 26:56Advanced decorator mechanics
- 38:30Timing functions with decorators
- 50:57Stateful decorators
- 1:09:02Caching and rate limiting
- 1:25:06Filtering inputs
- 1:37:23Metadata and parameterized decorators
- 1:45:42Stacking and class decorators
- 1:59:43Final discussion and wrap-up
related talks
02h 21mIntroduction to Decorators: Power Up Your Python Code
29mHow Decorators Function
03h 21mIntroduction to Decorators: Power Up Your Python Code
02h 32mIntroduction to Decorators: Power UP Your Python Code
29mOn the Use and Misuse of Decorators
01mDecorators Demystified
01mTutorial Sneak Peak: "All about decorators"
29mMetaprogramming with Decorators, Metaclasses, and Dynamic Code Generation
