From e3a985fe9aaa55088cf3cb03244949c72f8aaed9 Mon Sep 17 00:00:00 2001 From: Thomas Wouters Date: Tue, 19 Dec 2006 08:17:50 +0000 Subject: [PATCH] Make sre's SubPattern objects accept slice objects like it already accepts simple slices. --- Lib/sre_parse.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 319bf43b33f..e63f2acbb40 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