Next / Previous / Contents / TCC Help System / NM Tech homepage

21.1. basestring: The string base class

The class basestring is the parent class for the two string types, str and unicode. It exists not because you can call it (you can't), but for type testing. To test whether some value s is an instance of either type of string, use this predicate:

isinstance(s, basestring)

See Section 21.12, “isinstance(): Is a value an instance of some class or type?”.