Python · Functions, Closures and Iteration · Foundation · 28 min read
Python Functions, Arguments and Scope: Defaults, *args, **kwargs, Keyword-Only Parameters and LEGB
Design Python functions that are easy to call and hard to misuse. Learn how arguments are passed, positional versus keyword parameters, defaults and the mutable default trap, *args and **kwargs, positional-only and keyword-only markers, return values, docstrings, and the LEGB scope rules with global and nonlocal.
Create an account to start
Create a free account to see what this lesson covers
- Every free lesson in every section, in full
- Track your progress and pick up where you left off
- Free practice questions and an incident simulation
- Takes under a minute: name, email and a password
No card needed. Full access to Python is a paid upgrade you can choose later.