Re: Order of evaluation in conditionals

2008-02-25 Thread Karlo Lozovina
Paul Hankin wrote: > Did you try to find the answer to your question in the python > reference manual? The relevant page is > http://docs.python.org/ref/Booleans.html Of course I first Googled (even Google Groups-ed) it, but I didn't notice that in the results. > To quote it: > The expression '

Re: Order of evaluation in conditionals

2008-02-25 Thread Tim Chase
> if () and () and (): > do_something() > > Is there a guarantee that Python will evaluate those conditions in order (1, > 2, 3)? I know I can write that as a nested if, and avoid the problem > altogether, but now I'm curious about this ;). Yes, Python does short-circuit evaluation, from left-t

Re: Order of evaluation in conditionals

2008-02-25 Thread Paul Hankin
On Feb 25, 9:18 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > Hi all! Here is what's bugging me: let's say I have this code: > > if () and () and (): >   do_something() > > Is there a guarantee that Python will evaluate those conditions in order (1, > 2, 3)? I know I can write that as a nested if

Order of evaluation in conditionals

2008-02-25 Thread Karlo Lozovina
Hi all! Here is what's bugging me: let's say I have this code: if () and () and (): do_something() Is there a guarantee that Python will evaluate those conditions in order (1, 2, 3)? I know I can write that as a nested if, and avoid the problem altogether, but now I'm curious about this ;). Th