mardi 1 octobre 2019

If statement recheck in a loop?

So I have a simple if function:

def function():
    if my_var is True:
       #run program

Im looking for some effective way to recheck this statement as frequently as possible.

I know I can make a loop to run this every second or even use:

while True:
    function()

but maybe there is a better solution for this.

Looping this will require the use of threading or multiprocesing in my case and I'd prefer to avoid that.

Aucun commentaire:

Enregistrer un commentaire