Type constants?

Roy Smith roy at panix.com
Tue May 1 16:27:48 CEST 2001


Is there a way of writing type('') as a constant?  What I want to do
is check to see if an object is a string.  The best I can think of is
to do something like:

if type(foo) == type('')

which would work, but seems kind of silly.  Is there no pre-defined
object somewhere whose value is <type 'string'>?



More information about the Python-list mailing list