Matthew Barnett <pyt...@mrabarnett.plus.com> added the comment:

Even if this bug is fixed, it still won't work as you expect, and this s why.

The Scanner function accepts a list of 2-tuples. The first item of the tuple is 
a regex and the second is a function. For example:

    re.Scanner([(r"\d+", number), (r"\w+", word)])

The Scanner function then builds a regex, using the given regexes as 
alternatives, each wrapped as a capture group:

    r"(\d+)|(\w+)"

When matching, it sees which group captured and uses that to decide which 
function it should call, so, for example, if group 1 matched, it calls 
"number", and if group 2 matched, it calls "word".

When you introduce capture groups into the regexes, it gets confused. If your 
regex matches, it'll see that groups 1 and 2 match, so it'll try to call the 
second function, but there's isn't one...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12789>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to