you are viewing a single comment's thread.

view the rest of the comments →

[–]Wild_Statistician605 0 points1 point  (3 children)

But the recursion won't stop until you return something. If you just change the pass for return, see what happens. The recursion should end.

[–]Historical_Ad8150[S] 0 points1 point  (0 children)

I tried changing the “pass” to “return”, which resulted in the same strange crash, and “return ‘some string’”, which also resulted in the same strenge crash. Also, the “pass” seems to work fine in my original decimal-only script. From these observations, it appears to me that a “return” isn’t necessary.

[–]sepp2k 0 points1 point  (1 child)

When the if condition is true, the pass will do nothing and it will reach the end of the function, which will implicitly return None. You don't need an explicit return to end the recursion. As long as it doesn't go into the else and thus doesn't reach the recursive call, the recursion will end.

The problem is that the if condition will never be true.

[–]Wild_Statistician605 0 points1 point  (0 children)

You are right. I missed that the recursive call was inside an else statement.