[Python-checkins] r53063 - python/trunk/Lib/sre_parse.py

thomas.wouters python-checkins at python.org
Tue Dec 19 09:17:51 CET 2006


Author: thomas.wouters
Date: Tue Dec 19 09:17:50 2006
New Revision: 53063

Modified:
   python/trunk/Lib/sre_parse.py
Log:

Make sre's SubPattern objects accept slice objects like it already accepts
simple slices.



Modified: python/trunk/Lib/sre_parse.py
==============================================================================
--- python/trunk/Lib/sre_parse.py	(original)
+++ python/trunk/Lib/sre_parse.py	Tue Dec 19 09:17:50 2006
@@ -134,6 +134,8 @@
     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


More information about the Python-checkins mailing list