compound conditional statements
Jeremy Yallop
jeremy at jdyallop.freeserve.co.uk
Mon Sep 15 17:58:54 EDT 2003
beliavsky at aol.com wrote:
> If I have code
>
> if (aa or bb): print "true",
>
> does Python evaluate aa and bb in any particular order?
Yes. `aa' is evaluated first. If it is true, `bb' is not evaluated
and the value of `aa' is the value of the expreesion. If `aa' is
false, the value of `bb' is the value of the expression.
> Can I assume that if aa is true, bb will not be evaluated?
Yes.
Jeremy.
More information about the Python-list
mailing list