Am 15.01.21 um 15:01 schrieb Hélio Guilherme:
    ....


    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

Ah, true, Hélio. Thanks for your correction.

Artur
_______________________________________________
Gretl-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/

Reply via email to