Fredrik Lundh wrote: > it's slightly faster, but both your alternatives are about 10x slower > than a straightforward: > def balanced(txt): > return txt.count("(") == txt.count(")")
I know, but if you read my post again you see that I have shown those solutions to mark ")))(((" as bad expressions. Just counting the parens isn't enough. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list