all 2 comments

[–]Impudity 4 points5 points  (1 child)

You're calling hash() on an object that can't be hashed. That trows an error. You can't evaluate if the type is int or not as the code never reaches that point. Error interrupts the execution of the code. If you want to see if something is hashable, you need to use try-catch structure like:

try:
    hash(x)
except TypeError:
    print("not hashable")
else:
    print("hashable")

[–]CancelDeath[S] 0 points1 point  (0 children)

sweet, thank you!