How to check if a variable's type is primitive?

Viewed 43339

I don't know how to check if a variable is primitive. In Java it's like this:

if var.isPrimitive():
7 Answers

isinstance(obj, (str, numbers.Number) should be close enough:

python type hiearchy

Related