Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(no) fast boolean evaluation ?
- From: laurent.pointal at limsi.fr (Laurent Pointal)
- Subject: (no) fast boolean evaluation ?
- Date: Fri, 03 Aug 2007 10:00:13 +0200
Stef Mientki a ?crit :
> 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 ?
As it was replied, its standard behavior and cannot be modified.
IMHO, if you really need all your expressions to be evaluated, the clean
(most readable) way may be:
a = <first_expression which must be evaluated>
b = <second_expression(x,y,z) which must be evaluated>
if a and b :
...
A+
Laurent.
- References:
- (no) fast boolean evaluation ?
- From: Stef Mientki
- (no) fast boolean evaluation ?
- Prev by Date: i am new to python-Please somebody help
- Next by Date: __call__ considered harmful or indispensable?
- Previous by thread: (no) fast boolean evaluation ?
- Next by thread: (no) fast boolean evaluation ?
- Index(es):