summaryrefslogtreecommitdiffstats
path: root/Lib/stringold.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/stringold.py')
-rw-r--r--Lib/stringold.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/stringold.py b/Lib/stringold.py
index 6386a95..cc60678 100644
--- a/Lib/stringold.py
+++ b/Lib/stringold.py
@@ -163,3 +163,15 @@ def expandtabs(s, tabsize):
res = res + line
line = ''
return res + line
+
+
+# Try importing optional built-in module "strop" -- if it exists,
+# it redefines some string operations that are 100-1000 times faster.
+# The manipulation with index_error is needed for compatibility.
+
+try:
+ from strop import *
+ from strop import index
+ index_error = ValueError
+except ImportError:
+ pass # Use the original, slow versions