Intermediate Python 3: Functions, Namespaces, and Scope
Master how Python functions really work: every kind of parameter and argument, safe defaults, *args and **kwargs, keyword-only and positional-only parameters, unpacking, namespaces and the LEGB rule, closures, higher-order functions and decorators, with a shipping-toolkit project and a decorator-toolkit project.
- Intermediate level
- 3 modules
- 15 lessons
- 50 tasks and questions
Syllabus
01Function arguments in depthHow arguments bind to parameters and how to read binding errors, safe defaults with None and sentinels, *args and **kwargs and argument forwarding, keyword-only and positional-only parameters, unpacking in calls, literals and assignments, and a shipping-toolkit project.6 lessons
02Namespaces and scopeNames, namespaces and their lifetimes, evaluating code in namespaces you choose, the LEGB lookup rule and its surprises, global and nonlocal, and closures from the inside: cells, late binding and closures versus classes.4 lessons
03Functions deep diveFunctions as objects and callables, lambdas, higher-order functions and the operator module, the built-in higher-order toolkit, decorators with wraps, stacking and arguments, and a project building timing, caching, retry and validation decorators.5 lessons