What\'s the difference between:
isinstance(foo, types.StringType)
and
isinstance(foo, basestring)
?
For Python2: basestring is the base class for both str and unicode, while types.StringType is str. If you want to check if something is a string, use basestring. If you want to check if something is a bytestring, use str and forget about types.
basestring
str
unicode
types.StringType
types