I noticed something today while fiddling with my code:
print("lol") if None else print("Not lol") # Displays 'Not lol'
print("lol") if 0 else print("Not lol") # Displays 'Not lol'
print("lol") if float("nan") else print("Not lol") # Displays 'lol'
Unlike None
and 0
. Why is float("nan")
not considered Falsy?
Cheers