http://scons.tigris.org/issues/show_bug.cgi?id=2345
[scons.git] / src / engine / SCons / compat / _scons_UserString.py
index 785a260a1308800831cf106f049336e449753d45..59be10b8ce645505d4467206c70aacaaf62d6dca 100644 (file)
@@ -33,17 +33,13 @@ In particular, it does not necessarily contain all of the methods found
 in later versions.
 """
 
-import types
-
-StringType = types.StringType
-
-if hasattr(types, 'UnicodeType'):
-    UnicodeType = types.UnicodeType
+try: unicode
+except NameError:
     def is_String(obj):
-        return type(obj) in (StringType, UnicodeType)
+        return isinstance(obj, str)
 else:
     def is_String(obj):
-        return type(obj) is StringType
+        return type(obj) in (str, unicode)
 
 class UserString:
     def __init__(self, seq):
@@ -61,9 +57,9 @@ class UserString:
     def __complex__(self): return complex(self.data)
     def __hash__(self): return hash(self.data)
 
-    def __cmp__(self, string):
+    def __cmp__(self, str):
         if isinstance(string, UserString):
-            return cmp(self.data, string.data)
+            return cmp(self.data, str.data)
         else:
             return cmp(self.data, string)
     def __contains__(self, char):