Python recursion limit

前端 未结 3 1107
太阳男子
太阳男子 2021-01-23 17:54

So I understand the reason for the recursion limit of 1000. I want to run a script continuously, but am I right understanding that eventually the recursion limit will be reache

3条回答
  •  情深已故
    2021-01-23 18:37

    The recursion limit is only set with recursive functions from my understanding, so If you really want to run something repeatedly, you can simply run.

    while True:
       #repeated stuff goes here
    

    Recursion is an amazing tool, but handle with care, it often can end up burning you. You were right in the fact that python can only go 1000 calls deep recursively, so if you recursive method doesn't finish by then the exception gets thrown.

    Goodluck.

提交回复
热议问题