Ok, that’s a fair cop. I don’t usually code in Python and could well have got that wrong. Still, if that were the problem then the desired solution should have been a correction of my syntax error, not a change from two returns to one; so I stand by my criticism that the database is too small.
It’s clearly not big enough. :)
If you didn’t put a colon between 0 and return, it’s invalid syntax.
Ok, that’s a fair cop. I don’t usually code in Python and could well have got that wrong. Still, if that were the problem then the desired solution should have been a correction of my syntax error, not a change from two returns to one; so I stand by my criticism that the database is too small.
Isn’t the “return depth == 0” solution simpler and so superior? (That’s a question, I don’t actually know Python that well.)
A point of taste. My solution makes it explicit what is being checked for: Unclosed parens.