Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Is there a way to increase the maximum recursion depth?
-
http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python is a really slick Mandelbrot generator whose obfuscated Python code is also in the shape of the Mandelbrot set. On my MacBook Pro, Python runs it in 6 minutes 42 seconds and Pypy runs it in 1 minute 33 seconds. Unfortunately, Pythonista kicks out a RuntimeError: maximum recursion depth exceeded in cmp.
-
Wow, that code is pretty crazy! :)
You can try something like
sys.setrecursionlimit(1000)
. The default in Pythonista is intentionally quite conservative (something like 255) because I've seen some crashes with higher limits in the past, but as I just tried this, it seemed to work fine.I just ran the Mandelbrot script on my iPad Air, and it completed in 10 minutes, 13 seconds. That's faster than I expected, especially compared to your MacBook Pro. I actually had to run it twice, because after the first run, the resulting file wasn't readable... After some investigation, it turned out that the script doesn't close its file handle, so I added the following line at the end:
j.__self__.close()