[Python-Dev] SRE: what to do with undocumented attributes?

Guido van Rossum guido@python.org
Thu, 30 Mar 2000 18:31:43 -0500

> at this time, SRE uses types instead of classes for compiled
> patterns and matches.  these classes provide a documented
> interface, and a bunch of internal attributes, for example:
> RegexObjects:
>     code -- a PCRE code object
>     pattern -- the source pattern
>     groupindex -- maps group names to group indices
> MatchObjects:
>     regs -- same as match.span()?
>     groupindex -- as above
>     re -- the pattern object used for this match
>     string -- the target string used for this match
> the problem is that some other modules use these attributes
> directly.  for example, xmllib.py uses the pattern attribute, and
> other code I've seen uses regs to speed things up.
> in SRE, I would like to get rid of all these (except possibly for
> the match.string attribute).
> opinions?

Sounds reasonable.  All std lib modules that violate this will need to
be fixed once sre.py replaces re.py.

(Checkin of sre is next.)

--Guido van Rossum (home page: http://www.python.org/~guido/)