Comment

Peter Bengtsson

I like that one! It looks neat and pythonic. Maybe I should stop using isinstance() for basic types and use that weapon more around custom classes and instance objects.

Parent comment

Andrew Veitch

I would use: if type(value) is bool: elseif type(value) is int: elseif type(value) is float: which will work as expected.