Basically I want to do this:
obj = \'str\' type ( obj ) == string
I tried:
type ( obj ) == type ( string )
isinstance works:
isinstance
if isinstance(obj, MyClass): do_foo(obj)
but, keep in mind: if it looks like a duck, and if it sounds like a duck, it is a duck.
EDIT: For the None type, you can simply do:
if obj is None: obj = MyClass()