*args and **kwargs - Variable-Length Arguments in Python
Master Python's *args and **kwargs at engineering depth - how packing and unpacking work at the bytecode level, all 5 parameter types in order, forwarding patterns, decorator argument passing, and the anti-patterns that signal poor API design.
Closures - Functions That Remember Their Environment
Master Python closures at engineering depth - how inner functions capture free variables in cell objects, the classic loop-variable bug, nonlocal, function factories, closures as lightweight classes, and real-world patterns like memoization and event handler factories.
Default Parameters and the Mutable Default Argument Trap
Master Python default parameter values - understand why mutable defaults are one of Python's most common bugs, how defaults are evaluated at definition time, and the correct None sentinel pattern used in production code.
Defining Functions in Python - def, Bytecode, and First-Class Objects
Master Python function definition at engineering depth - how def compiles to bytecode, what a function object contains, why functions are first-class values, and how to pass and store them like any other object.
Designing Clean Function APIs - The Art of Good Interfaces
Master the principles of clean function API design - naming, parameter conventions, single responsibility, type consistency, testability, and the patterns that make Python code a joy to use and maintain.
Higher-Order Functions - Functions as First-Class Citizens
Master Python higher-order functions at engineering depth - map, filter, reduce, functools.partial, lru_cache, function composition, and building your own pipelines. Learn when to use functional patterns and when to prefer comprehensions.
Keyword-Only and Positional-Only Parameters - Designing Explicit Python APIs
Master Python's * and / separators for keyword-only and positional-only parameters. Learn how these enforce calling conventions, protect API stability, and make function signatures communicate intent clearly.
Module 05: Functions and Modularity - Complete Overview
Master Python functions at engineering depth - from bytecode compilation and first-class objects to closures, recursion, higher-order functions, and clean API design. The most complete functions module on the web.
None and Implicit Return - The Invisible Return Value
Master Python's None object and implicit return semantics - why every function returns something, what None really is at the CPython level, and how invisible returns cause real production bugs.
Parameters vs Arguments - Python's Pass-by-Object-Reference Model
Understand the semantic difference between parameters and arguments in Python, and master Python's pass-by-object-reference model - neither pass-by-value nor pass-by-reference, but something more precise and powerful.
Python *args and **kwargs Practice Problems & Exercises
<PracticePageHeader
Python Closures Intro Practice Problems & Exercises
Solve 11 Python closures intro problems. Covers closures practice, free variables, late binding. Hints and solutions.
Python Default Parameters Pitfalls: Practice Problems & Exercises
Solve 11 Python default parameters pitfalls problems. Covers mutable default, None sentinel, default parameter. Hints and solutions.
Python Defining Functions Practice Problems & Exercises
Solve 11 Python defining functions problems. Covers functions practice, def exercises, function design. Hints and solutions.
Python Designing Clean APIs Practice Problems & Exercises
Solve 11 Python designing clean apis problems. Covers clean api, function naming, single responsibility. Hints and solutions.
Python Higher-Order Functions Practice Problems & Exercises
<PracticePageHeader
Python Keyword-Only Practice Problems & Exercises
<PracticePageHeader
Python None and Implicit Return Practice Problems & Exercises
Solve 11 Python none and implicit return problems. Covers None practice, implicit return, is None. Hints and solutions.
Python Parameters vs Arguments Practice Problems & Exercises
Solve 11 Python parameters vs arguments problems. Covers parameters vs, pass by, rebinding vs, mutable argument. Hints and solutions.
Python Recursion Fundamentals Practice Problems & Exercises
Solve 11 Python recursion fundamentals problems. Covers recursion practice, recursive functions. Hints and solutions.
Python Return Semantics Practice Problems & Exercises
Solve 11 Python return semantics problems. Covers multiple return, tuple unpacking, guard clause. Hints and solutions.
Python Scope and LEGB Practice Problems & Exercises
Solve 11 Python scope and legb problems (4 Easy, 4 Medium, 3 Hard). Practice scope practice, LEGB rule, global keyword with hints, runnable code, and solutions.
Python Stack Frames Practice Problems & Exercises
Solve 11 Python stack frames and call stack problems. Covers call stack, stack frame, inspect module. Hints and solutions.
Python Tail Recursion Concept Practice Problems & Exercises
Solve 11 Python tail recursion concept problems. Covers tail recursion, trampoline pattern, accumulator pattern. Hints and solutions.
Recursion Fundamentals - Thinking in Self-Reference
Master Python recursion at engineering depth - base cases, recursive reduction, call stack mechanics, Python's recursion limit, classic algorithms, the dramatic performance difference between naive and memoized Fibonacci, and when recursion is the right tool.
Return Semantics - What Python Functions Actually Return
Master Python return semantics at engineering depth - how the RETURN_VALUE opcode works, why multiple return values are actually tuples, guard clauses, type-consistent returns, factory functions, and the Result pattern for error handling without exceptions.
Scope and LEGB - How Python Resolves Names
Master Python's scope resolution at engineering depth - the LEGB rule, how the compiler decides LOAD_FAST vs LOAD_GLOBAL at compile time, global and nonlocal keywords, and common scope bugs.
Stack Frames and Call Stack - Inside Python's Execution Model
Master Python's call stack at engineering depth - PyFrameObject internals, how each function call creates a frame, how to inspect the stack, and why this matters for generators, async/await, and debugging.
Tail Recursion - Why Python Doesn't Optimize It and What to Do
Understand tail recursion and tail call optimization (TCO), why Python deliberately does not implement TCO, and the practical techniques to handle deep recursion safely in Python.