On 8/2/07, Stef Mientki <[EMAIL PROTECTED]> 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 ? >
This is standard behavior in every language I've ever encountered. If you are evaluating an and/or with side effects and you need both side effects to occur, you can trivially write functions implementing this behavior, e.g. def a(): print 'foo' def b(): print 'bar' def my_and(lh, rh): return a and b Then my_and(a(), b()) will evaluate both a and b and print both foo and bar even though a() is False. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list