Python Language Short-circuit evaluation


Example

Python minimally evaluates Boolean expressions.

>>> def true_func():
...     print("true_func()")
...     return True
... 
>>> def false_func():
...     print("false_func()")
...     return False
... 
>>> true_func() or false_func()
true_func()
True
>>> false_func() or true_func()
false_func()
true_func()
True
>>> true_func() and false_func()
true_func()
false_func()
False
>>> false_func() and false_func()
false_func()
False