As I recall, short-circuit is referring to a compiler optimization. As you are already aware, in an AND conditional, the second expression is not evaluated if the first condition is false. After all, what is the point? The overall expression CANNOT be true since the first condition is already false. Similarly, with the OR logic, as soon as a single condition is true, the entire OR expression is true. This boils down to runtime savings. Expressions can be left unevaluated and thus not burn any CPU cycles.
Incidentally, I use OR short-circuits all the time in bash programming. For example, the following expression is useful for running a function if the preceeding condition is false:
[ $# -ge 2 ] || errexit "You have not supplied enough parameters"
In the above example, errexit will be called only if the command line did not have 2 arguments or more. Of course, in my example, I don't care about performance. Rather, I'm using the || short circuit logic as syntactic sugar.
And that's what it boils down to: In a tight loop, where performance matters, you can be somewhat certain that expressions will not be evaluated unnecessarily. But in the example that you described for && to avoid divide by zero, you could have just as easily written that with a nested IF statement. Again, it's a style choice more often than a performance consideration.
All that said, let me answer your questions one at a time:
I can't understand exact meaning of the second paragraph. In C, we can use the &&(logical and) as the following expression: (i != 0) &&
(j / i > 0) to prevent the error of a division by zero. So then, could
I use the expression (i != 0) and ( j / i > 0) in Python as C to get
the same effect? Is my understanding to the passage right?
You are correct.
What's the usage of or as a short-circuit to constructing Boolean expressions as said in the second paragraph ?
As I explained in detail above: performance and syntax sugar ( that is, less typing and shorter expressions; idioms ).
The final question is about the grammar of had the prior test not
succeeded in the second paragraph. I this it should be "an error
condition that can had the prior test not succeeded", am I right?
I agree with you that the statement could be worded better. But when you try to express it, you'll see that it is a difficult thing to do ( in fact, your suggestion is not valid ). Basically, your example of avoiding divide by zero error is a perfect example of what the author is trying to say. Here's my attempt to paraphrase: Short-circuit logic is useful to check pre-conditions of expressions that may generate errors if those conditions are not met.
i != 0 and j / i > 0. Onlyx if y else zexpressions andlambdafunctions have lower precedence, and I can't even think of a way to have those usefully show up within a term of a Boolean operator (it's possible, but will almost never happen in real-word code).