Order of evaluation in conditionals

Karlo Lozovina _karlo_ at mosor.net
Mon Feb 25 16:18:23 EST 2008


Hi all! Here is what's bugging me: let's say I have this code:

if (<condition1>) and (<condition2>) and (<condition3>):
  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 ;).

Thanks...

-- 
Karlo Lozovina -- Mosor



More information about the Python-list mailing list