I'm optimizing the performance of some Python code and once read that "obsolete" code in boolean expressions is not executed to save computing time. So I've created the following test program:
def fun(p):
print p
return False
if fun(1) and fun(2):
print "This shouldn't print"
This code only prints one line.
1
So fun(2) is not called, because it won't change the result of the "and".
I'd like to learn more about this feature, but I don't know the right name/term to search for. What's this feature called?