need some regular expression help

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sun Oct 8 08:27:29 EDT 2006


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




More information about the Python-list mailing list