これはびっくりした。なのでメモ。 i = 123 isinstance(i, int) # => True a = True isinstance(a, int) # => True b = False isinstance(b, int) # => True c = 1 isinstance(c, int) # => True d = 0 isinstance(d, int) # => True えぇー! i = 123 isinstance(i, bool) # => False a = True isinstance(a, bool) # => True b = False isinstance(b, bool) # => True c = 1 isinstance(c, bool) # => False d = 0 isinstance(d, bool) # => False ほっ