Predict the output
What does this print?
import sys
print(sys.getrecursionlimit())Choose an answer, then open Show answer below to check it.
Show answer
Answer: A 1000
Right: CPython's default recursion limit is 1000.
A chain-shaped tree deeper than the limit makes recursive walks fail, which is when an explicit stack helps.
Why not the others?
- B 10000. That is a common value people set by hand, not the default.
- C Unlimited. CPython caps recursion to avoid crashing the C stack.