Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(no) fast boolean evaluation ?
- From: iclark at mail.ewu.edu (Ian Clark)
- Subject: (no) fast boolean evaluation ?
- Date: Thu, 02 Aug 2007 15:55:44 -0700
Stef Mientki wrote: > hello, > > I discovered that boolean evaluation in Python is done "fast" > (as soon as the condition is ok, the rest of the expression is ignored). > > Is this standard behavior or is there a compiler switch to turn it on/off ? > > thanks, > Stef Mientki It's called short circuit evaluation and as far as I know it's standard in most all languages. This only occurs if a conditional evaluates to True and the only other operators that still need to be evaluated are 'or's or the condition evaluates to False and all the other operators are 'and's. The reason is those other operators will never change the outcome: True or'd with any number of False's will still be True and False and'ed to any number of Trues will still be False. My question would be why would you *not* want this? Ian
- References:
- (no) fast boolean evaluation ?
- From: Stef Mientki
- (no) fast boolean evaluation ?
- Prev by Date: __call__ considered harmful or indispensable?
- Next by Date: __call__ considered harmful or indispensable?
- Previous by thread: (no) fast boolean evaluation ?
- Next by thread: (no) fast boolean evaluation ?
- Index(es):