david.reitter wrote: > So I would expect None rather than an IndexError, which is (only?) > supposed to occur "If a string argument is not used as a group name in > the pattern". That is exactly what does happen.
> > I would expect named groups and numbered groups to be behave the same > way. > Where's my mistake? Using 'maybe' as a group name when the only group in the pattern is called 'm'. > >>>> import re >>>> m = re.match('(?P<m>maybe)?yes', "yes") >>>> m.group(1) >>>> m.group('maybe') > Traceback (most recent call last): > File "<stdin>", line 1, in ? > IndexError: no such group > -- http://mail.python.org/mailman/listinfo/python-list