From: Thomas Wouters Date: Tue, 19 Dec 2006 08:17:50 +0000 (+0000) Subject: Make sre's SubPattern objects accept slice objects like it already accepts X-Git-Tag: v2.6a1~2361 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3a985fe9aaa55088cf3cb03244949c72f8aaed9;p=python Make sre's SubPattern objects accept slice objects like it already accepts simple slices. --- diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 319bf43b33..e63f2acbb4 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