From 2db91358def94cf8081f27b736988320d14eba39 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 18 Oct 1992 17:09:59 +0000 Subject: Misc changes and new modules. whrandom is "objectified". SOCKET.py is moved to the sgi subdirectory. --- Lib/string.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Lib/string.py') diff --git a/Lib/string.py b/Lib/string.py index 6386a9549d..cc60678bfb 100644 --- a/Lib/string.py +++ b/Lib/string.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 -- cgit v1.2.1