recursion depth <= vagina depth
Name:
Anonymous
2009-05-14 10:08
Runtime Error: maximum recursion depth exceeded
How annoying.
What's the maximum number of recursive calls you can make in FIOC?
def fioc(n):
"""The Forced Indentation Of Code"""
print(n, end=" ")
fioc(n+1)
Name:
Anonymous
2009-05-14 10:14
(...) 982 983 984Traceback (most recent call last)
Name:
Anonymous
2009-05-14 12:03
(...) 12087 12088 12089 12090 1209Segmentation fault (core dumped)
12000-ish seems to be the upper limit.
Name:
Anonymous
2009-05-14 12:04
p.s.: sys.setrecursionlimit(n)
Name:
Anonymous
2009-05-14 12:40
(...) 3 4 5 ERROR 14 MEMORY
Name:
Anonymous
2009-05-14 13:23
It depends on your OS. On Windows the default is 2000, I thought. On Linux it tends to be higher.
Name:
Anonymous
2009-05-14 13:27
>>> sys.getrecursionlimit()
1000
Name:
Anonymous
2009-05-14 13:36
>>> sys.setrecursionlimit(2**31-1)
>>> fioc(1)
[...]
18058
zsh: segmentation fault python
%
Name:
Anonymous
2009-05-14 13:39
Recursion is only useful for toy problems. Nobody uses it in real life.
Name:
Anonymous
2009-05-14 13:41
s/Recursion/Non-tail recursion/
Name:
Anonymous
2009-05-14 14:25
Python 2.6.2 (r262:71600, Apr 28 2009, 18:26:01)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def fioc(n):
... """The Forced Indentation Of Code"""
... print(n, end=" ")
File "<stdin>", line 3
print(n, end=" ")
^
SyntaxError: invalid syntax
>>>
;__;
Name:
Anonymous
2009-05-14 14:33
linux
There's your problem.
Name:
Anonymous
2009-05-14 14:40
>>9
Write a stack implementation on the heap that will run as fast as the call stack.
Rationale: adaptive methods for numeric integration
Name:
Anonymous
2009-05-14 15:14
>>11
Python 2.6 needs
from __future__ import print_function.
Name:
Anonymous
2009-05-14 15:17
the next version of python has tail recursion so just wait for an upgrade
Name:
Anonymous
2009-05-14 15:18
ONE WORD
FORCED INCREMENT OF STACK DEPTH
RECURSION OVER
Name:
Anonymous
2009-05-14 17:10
So what does this thread have to do with vaginas? What a misleading title!
Name:
Anonymous
2009-05-14 23:10
>>17
None of the participants have one.
Name:
Anonymous
2009-05-16 7:58
>>> def fioc(n): __import__("sys").stdout.write(str(n) + "\n") or fioc(n+1)
...
>>> fioc(0)
997
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Python 2.5.4
Name:
Anonymous
2011-02-03 1:18