summaryrefslogtreecommitdiffstats
path: root/Lib/stringold.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-10-18 17:09:59 (GMT)
committerGuido van Rossum <guido@python.org>1992-10-18 17:09:59 (GMT)
commit2db91358def94cf8081f27b736988320d14eba39 (patch)
treef73562d6cfd16adf8723bbe702be55d13e2122f5 /Lib/stringold.py
parent0cb8e8cfc09dd0919882da968c3e95bf070e257d (diff)
downloadcpython-2db91358def94cf8081f27b736988320d14eba39.zip
cpython-2db91358def94cf8081f27b736988320d14eba39.tar.gz
cpython-2db91358def94cf8081f27b736988320d14eba39.tar.bz2
Misc changes and new modules. whrandom is "objectified". SOCKET.py
is moved to the sgi subdirectory.
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