import sys
sys.setrecursionlimit(100)
depth = 0
def main():
global depth
print(depth)
depth += 1
return main()
main()
经过测试发现,python 没有进行 rvo 优化,是我测试姿势问题,还是其他什么原因?望 dalao 指教。
1
QAPTEAWH 2017 年 12 月 19 日
这个叫 TCO 吧
|
2
jotsai 2017 年 12 月 19 日
你想说尾递归优化吧,Python 没有
|
3
VicYu 2017 年 12 月 19 日 |