MRAB <[EMAIL PROTECTED]> writes:

>
> I think the problem is with this bit: '(?:(?:::)?\w+)*'. The '::' is
> optional and also in a repeated group, so if it tries to match, say,
> 'abc' it can try and then backtrack all of these possibilities: abc,
> ab c, a bc, a b c. The longer the string, the more possibilities to
> try. Try this instead:
>
>     r = re.compile (
>         r'(?P<scope>(?:::)?(?:\w+::)*)?'
>         r'(?P<name>\w+)'
>         r'(?:\((?P<arguments>[^\)]*)\))?'
>         )

That was indeed the problem. Your version is ok w/ the minor difference
that the named group <scope> includes the '::' at the end. This can be
easily stripped off. Or maybe the regexp can be massaged further.
Thanks a lot,

       Maurizio
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to