conditional execution short-circuit evaluation of logical expressions when python is processing logical expression such as > and ( / it evaluates the expression from left to right because of the definition of andif is less than the expression > is false and so the whole expression is false regardless of whether ( / evaluates to true or false when python detects that there is nothing to be gained by evaluating the rest of logical expressionit stops its evaluation and does not do the computations in the rest of the logical expression when the evaluation of logical expression stops because the overall value is already knownit is called short-circuiting the evaluation while this may seem like fine pointthe short-circuit behavior leads to clever technique called the guardian pattern consider the following code sequence in the python interpreterx > and ( / true > and ( / false > and ( / traceback (most recent call last)file ""line in zerodivisionerrordivision by zero the third calculation failed because python was evaluating ( /yand was zerowhich causes runtime error but the first and the second examples did not fail because in the first calculation was non zero and in the second one the first part of these expressions > evaluated to false so the ( /ywas not ever executed due to the short-circuit rule and there was no error we can construct the logical expression to strategically place guard evaluation just before the evaluation that might cause an error as followsx > and ! and ( / false > and ! and ( / false > and ( / and !