Each call gets its own frame on the call stack, with its own copy of n. A frame only finishes after every call it made has finished.
n
def echo(n): if n == 0: return print("in", n) echo(n - 1) print("out", n) echo(2)
in 2 out 2 in 1 out 1
in 2 in 1 out 2 out 1
in 2 in 1 out 1 out 2
in 2 in 1