Answer the question
In order to leave comments, you need to log in
Are the rest of the python if statements executed if the result is already clear from the first statement?
I did not immediately find something in the documentation at this point
. If there is such an
if a and b and c:
where a, b, c are very very heavy functions,
will b, c be executed if a returned false?
Answer the question
In order to leave comments, you need to log in
It's easy to check:
>>> def return_false1():
... print('run 1')
... return False
...
>>> def return_false2():
... print('run 2')
... return False
...
>>> def return_false3():
... print('run 3')
... return False
...
>>>
>>> if return_false1() and return_false2() and return_false3():
... print('I newer executed')
...
run 1
>>>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question