+ 2
How to change recursion limit in skuplt python?
Skuplt is web python.I use it on SL to show my turtle codes .(Thanks to Burey ). But how can I change recursion limit on it.I have created a fractal code so I need recursion.The error i get is : ExternalError:RangeError:Maximum call stack size exceeded . https://code.sololearn.com/WFuyfuqpQ7bb/?ref=app
13 Answers
+ 7
It is a guard against a stack overflow, yes. Python (or rather, the CPython implementation) doesn't optimize tail recursion, and unbridled recursion causes stack overflows. You can change the recursion limit with sys.setrecursionlimit, but doing so is dangerous -- the standard limit is a little conservative, but Python stackframes can be quite big.
Python isn't a functional language and tail recursion is not a particularly efficient technique. Rewriting the algorithm iteratively, if possible, is generally a better idea.
source: stackoverflow
+ 6
Without seeing the code itself the problem could be that a new event comes in while your event hander is still processing the previous event, so the event handler gets called from inside the event handler which looks like a recursion! The fix is to disable the event binding while inside the event handler:
+ 6
*{ margin:0px; left:0px; } in the css
https://code.sololearn.com/W0QhCFfEBi85/?ref=app
+ 6
Swapnil More / Saksham Jain
I kept running into the same issue even after I shrunk it and tried to move it further to the left margin... as to the consuming of the stack.
https://code.sololearn.com/WvoKWC1F29nI/?ref=app
+ 4
Saksham Jain try using an if else to restore caesars values before line line 21 or 22
I would say to try
caesara.reset_orig()
caesara.reset_defaults()
But I'm not sure that really would work as you have 3 values... And they would reset prematurely
+ 3
Swapnil More did you created 4 turtles? Now how can I change the location of square?I want it to be a bit up and a bit left
+ 3
https://code.sololearn.com/WhmXtVn3aJgE/?ref=app
Not working BroFarOps
And Swapnil More if I add just one more go-to command it gets out of range as you can see..
+ 2
BroFarOps Swapnil More Can you guys help?
+ 1
BroFarOps I have now inserted the code and I am not using any event handlers .
+ 1
Saksham Jain that's the reason I removed those coordinates because changing the position of turtle was consuming the stack
+ 1
Swapnil More /BroFarOps but that works on square but suppose I want to generalize carsaro square to n polygon caesaro then this way won't work...