← All terms · Functions
Default argument
Parameter with a fallback value: `def f(x=10)`. Beware mutable defaults — `def f(xs=[])` is a classic trap.
Learn this interactively:
Open lesson lesson-60 →Related — Functions
FunctionNamed reusable block of code. Defined with `def`. First-class — you can pass fun…*args, **kwargsCapture variable positional and keyword arguments. Lets a function accept any si…LambdaAn anonymous one-line function: `lambda x: x*2`. Use for short callbacks; prefer…DecoratorA higher-order function that wraps another to add behavior — logging, caching, a…ClosureAn inner function that captures variables from its enclosing scope. The captured…