compound conditional statements

Steve Holden sholden at holdenweb.com
Mon Sep 15 19:12:14 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? Can I assume that
if
> aa is true, bb will not be evaluated?

Yes. Both "and" and "or" are specifcally short-circuiting.

regards
-- 
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/







More information about the Python-list mailing list