1.Function calls
Calling f(args) creates a new frame, binds each argument to its parameter name inside that frame, runs the function body, and destroys the frame when it returns — handing the return value back to the caller.
Key features
- f(args) binds each argument to its parameter name in a brand-new, per-call frame
- The function body runs using that frame's local namespace — see local/global namespaces
- A function with no explicit return returns None implicitly
- The frame is destroyed once the function returns — its local names cease to exist
- Every call gets its OWN frame — recursive calls to the same function never share one
What a call to f(a, b) does, step by step
Command
def f(a, b):
return a + b
f(2, 3) # creates a frame, binds a=2 b=3, runs the body, returns 5, discards the frameEvery call to f(args) creates a brand-new frame, binds arguments inside it, runs the body, then discards the frame. Recursive calls never share a frame.