[Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Dec 5 01:15:58 CET 2006


Nick Coghlan wrote:

> *The inconsistency being that group() considers the whole match to be group 0, 
> while groups() does not.

The real inconsistency seems to be that the groups
are being treated as an array when they're really
a tree. Maybe a different API altogether would
be better, e.g.

   m.range --> the whole match

   m.subgroups[i] --> another match object with its
                      own range and subgroups attributes

--
Greg


More information about the Python-Dev mailing list