[issue40225] recursive call within generator expression is O(depth)
Rémi Lapeyre
report at bugs.python.org
Thu Apr 9 09:21:31 EDT 2020
Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:
I'm unable to run the example as it segfaults on my computer because of the linear recursion but do you notice the same behavior with:
from time import time
from sys import setrecursionlimit
setrecursionlimit(10000000)
def recurse(i):
if i < 0:
return
recurse(i-1)
if __name__ == '__main__':
lo = 8
hi = 16
t = {}
for sh in range(lo, hi):
b4 = time()
x = 1 << sh
ret = recurse(x)
after = time()
t[sh] = after - b4
for sh in range(lo+1, hi):
print(t[sh] / t[sh-1])
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40225>
_______________________________________
More information about the Python-bugs-list
mailing list