....


Python does not throw an error and returns "1"
<python>
import math
foo = math.nan
actual = 0
if foo:
     actual += 1

print(actual)
</python>


So, two of the three languages I used throw an error. Python is known
for its rather "sloppy" handling of types :-D
....

 Python has the "everything is an object, except None" rule. You are not testing for boolean but the existence of objects.

foo = None
if foo:
    print("foo exists")

import math
bar = math.nan
if bar:
     print("bar exists")

>>>bar exists