summaryrefslogtreecommitdiffstats
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-12-19 08:17:50 (GMT)
committerThomas Wouters <thomas@python.org>2006-12-19 08:17:50 (GMT)
commite3a985fe9aaa55088cf3cb03244949c72f8aaed9 (patch)
treeea530bebffe8718489e8755558825c56d9ee4ad9 /Lib/sre_parse.py
parentab4b873f81ccdae353054e033d4c2fa6d09a1b49 (diff)
downloadcpython-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.py2
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