Does Python optimize tail recursion?

后端 未结 6 1038
情深已故
情深已故 2020-11-22 02:30

I have the following piece of code which fails with the following error:

RuntimeError: maximum recursion depth exceeded

I attemp

6条回答
  •  甜味超标
    2020-11-22 03:29

    CPython does not and will probably never support tail call optimization based on Guido van Rossum's statements on the subject.

    I've heard arguments that it makes debugging more difficult because of how it modifies the stack trace.

提交回复
热议问题