I think this is better:
if sys.hexversion >= 0x02020000: # Python 2.2 or greater
def isstring (x):
return isinstance(x, types.StringTypes)
else:
def isstring (x):
return type(x) in (types.StringType, types.UnicodeType)
No use doing the version check on every hit.
Neil