mercredi 6 janvier 2021

Does python stop verification on first wrong condition in "if and" or does it check it all before deciding? [duplicate]

I have multiple expensive condition to make and I am wondering if this:

if False and False and True and False:
    print("you will never see this")

is longer than this in time computing:

if False:
    if False:
        if True:
            if False:
                print("you will never see this")

Will python stop the first time it see a wrong condition or will it compute every verification before deciding ?

Aucun commentaire:

Enregistrer un commentaire