⬅︎ Back to bool is instance of int in Python
This is actually less useful than the original. With this code only bools, integers, and floats would be checked, meaning any subclassing of int or float would not be caught.
I would use: if type(value) is bool: elseif type(value) is int: elseif type(value) is float: which will work as expected.
Comment
This is actually less useful than the original. With this code only bools, integers, and floats would be checked, meaning any subclassing of int or float would not be caught.
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.