S
Steven D'Aprano
I'm seeing a strange interaction between timeit and recursion.
.... if n < 999: return test(n+1)
.... return None
.... """Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/timeit.py", line 188, in repeat
t = self.timeit(number)
File "/usr/lib/python2.5/timeit.py", line 161, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 9, in inner
File "<timeit-src>", line 4, in test
File "<timeit-src>", line 4, in test
File "<timeit-src>", line 4, in test
...
File "<timeit-src>", line 4, in test
I don't understand why my recursive function hits the recursion limit
inside the timeit.Timer when it works outside of it.
Is there any way to see the current recursion depth at a particular
moment?
.... if n < 999: return test(n+1)
.... return None
.... """Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/timeit.py", line 188, in repeat
t = self.timeit(number)
File "/usr/lib/python2.5/timeit.py", line 161, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 9, in inner
File "<timeit-src>", line 4, in test
File "<timeit-src>", line 4, in test
File "<timeit-src>", line 4, in test
...
File "<timeit-src>", line 4, in test
I don't understand why my recursive function hits the recursion limit
inside the timeit.Timer when it works outside of it.
Is there any way to see the current recursion depth at a particular
moment?