issue2636-03 : Code : Python

lp:~pythonregexp2.7/python/issue2636-03

Created by TimeHorse and last modified

Add subscript operators and len and iteration semantics to the match object. Initially, the idea was to allow the use of subscript operators ([]) to access, get ranges of and slice a match object where index represents the value passed to group to obtain ordinal match groups. This, as a consequence, would imply the use of the __len__ property and iteration over a match object so those changes will also be attempted here. In other words, m.group(n) could be written m.group[n], where n could be a ordinal value (0, 1, 2, ...) or a named match string (e.g. 'foo'). Because m.group(0) returns the entire match, m[0] would also do so. However, this may not be desirable in all cases, so in addition to m[1:] being made valid, a new method, captures(self) will be added that will return an iterator suitable for iteration over JUST the capture groups.

Get this branch:
bzr branch lp:~pythonregexp2.7/python/issue2636-03

Branch merges

Related bugs

Related blueprints

Branch information

Recent revisions

39029. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39028. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39027. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39026. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39025. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39024. By Jeffrey C. Jacobs <email address hidden>
39023. By Jeffrey C. Jacobs <email address hidden>
39022. By Jeffrey C. Jacobs <email address hidden>
39021. By armin.rigo
39020. By neal.norwitz

Branch metadata

Branch format:
Branch format 6
Repository format:
Bazaar pack repository format 1 with rich root (needs bzr 1.0)