Advanced Python
Q78 / 101

What does sys.setrecursionlimit do and what is its trade-off?

Correct! Well done.

Incorrect.

The correct answer is B) Changes the maximum call stack depth, allowing deeper recursion at the cost of potential segfault if set too high

B

Correct Answer

Changes the maximum call stack depth, allowing deeper recursion at the cost of potential segfault if set too high

Explanation

The default limit is 1000. Increasing it allows deeper recursion but can crash the interpreter with a C stack overflow if pushed too far. Consider iteration or tail-call elimination instead.

Progress
78/101