diff options
author | Thomas Wouters <thomas@python.org> | 2006-12-19 08:17:50 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-12-19 08:17:50 (GMT) |
commit | e3a985fe9aaa55088cf3cb03244949c72f8aaed9 (patch) | |
tree | ea530bebffe8718489e8755558825c56d9ee4ad9 /Lib/sre_parse.py | |
parent | ab4b873f81ccdae353054e033d4c2fa6d09a1b49 (diff) | |
download | cpython-e3a985fe9aaa55088cf3cb03244949c72f8aaed9.zip cpython-e3a985fe9aaa55088cf3cb03244949c72f8aaed9.tar.gz cpython-e3a985fe9aaa55088cf3cb03244949c72f8aaed9.tar.bz2 |
Make sre's SubPattern objects accept slice objects like it already accepts
simple slices.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 319bf43..e63f2ac 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -134,6 +134,8 @@ class SubPattern: def __delitem__(self, index): del self.data[index] def __getitem__(self, index): + if isinstance(index, slice): + return SubPattern(self.pattern, self.data[index]) return self.data[index] def __setitem__(self, index, code): self.data[index] = code |