compound conditional statements

Steve Holden sholden at
Tue Sep 16 01:12:14 CEST 2003

<beliavsky at> 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
> aa is true, bb will not be evaluated?

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

Steve Holden                        
Python Web Programming       

More information about the Python-list mailing list