summaryrefslogtreecommitdiff
path: root/Lib/sre.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2004-08-25 02:22:30 +0000
committerBarry Warsaw <barry@python.org>2004-08-25 02:22:30 +0000
commit8bee76106e8da9fd6011432d2f60861a94c623db (patch)
tree813980417d605a18837bead1951ff22a8e2b10b6 /Lib/sre.py
parentc8854434790d3a281f0ea5a4714e5c01414413b0 (diff)
downloadcpython-git-8bee76106e8da9fd6011432d2f60861a94c623db.tar.gz
PEP 292 classes Template and SafeTemplate are added to the string module.
This patch includes test cases and documentation updates, as well as NEWS file updates. This patch also updates the sre modules so that they don't import the string module, breaking direct circular imports.
Diffstat (limited to 'Lib/sre.py')
-rw-r--r--Lib/sre.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/Lib/sre.py b/Lib/sre.py
index bb4bc1678a..8bf0fad321 100644
--- a/Lib/sre.py
+++ b/Lib/sre.py
@@ -105,9 +105,6 @@ __all__ = [ "match", "search", "sub", "subn", "split", "findall",
__version__ = "2.2.1"
-# this module works under 1.5.2 and later. don't use string methods
-import string
-
# flags
I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case
L = LOCALE = sre_compile.SRE_FLAG_LOCALE # assume current 8-bit locale
@@ -201,7 +198,7 @@ def escape(pattern):
s[i] = "\\000"
else:
s[i] = "\\" + c
- return _join(s, pattern)
+ return pattern[:0].join(s)
# --------------------------------------------------------------------
# internals
@@ -213,10 +210,6 @@ _pattern_type = type(sre_compile.compile("", 0))
_MAXCACHE = 100
-def _join(seq, sep):
- # internal: join into string having the same type as sep
- return string.join(seq, sep[:0])
-
def _compile(*key):
# internal: compile pattern
cachekey = (type(key[0]),) + key