cribeiro at mail.inet.com.br
Fri Feb 7 12:23:07 CET 2003
On Friday 07 February 2003 04:15 am, David LeBlanc wrote:
> if a > b and c < d():
> print e
> d() might never get called. Not good if d() does something you depend on.
But is just perfect in some cases (common in programs that rely on short
circuiting) where the evaluation of d() depends upon some condition that is
tested first. The usual case is something like this:
if a <> 0 and c < (b/a):
That's just to point out why short-circuiting might be useful. Anyway, it's a
religious debate over the choice of short-circuiting x full evaluation, and
there are *lots* of good arguments from both sides. Performance wise, short
circuiting will be faster, and probably a bit safer in 'normal' situations.
More information about the Python-list