are you using it to calculate a value in a new field? or are you using it within a field calculator expression? And it may actually be returning something but not what you expect. It is often more useful to use isinstance
a = 5
>>> isinstance(a,(int, float, complex))
True
You can then use it to its full advantage to control what goes into the field based upon its type/class. For example to make an entry a string, you can check for its type, then do one thing and if it is something else, do another thing. So to use the field entry (a =5) lets, make it a string if it is a number otherwise do something else
["string already", str(a)][ isinstance(a, (int,float,complex))]
This just uses boolean slicing with the left side representing [do this if false, do this if true]
and the right side returning a boolean ... [ isinstance check ] since True and False equate to 1 and 0