⬅︎ Back to bool is instance of int in Python
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.
I would use: if type(value) is bool: elseif type(value) is int: elseif type(value) is float: which will work as expected.
Comment
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
I would use: if type(value) is bool: elseif type(value) is int: elseif type(value) is float: which will work as expected.