On Apr 17, 12:15 pm, Paul McGuire <pt...@austin.rr.com> wrote: > On Apr 17, 10:43 am, John Machin <sjmac...@lexicon.net> wrote: snip > not only does this handle > "0.00 LE A LE 4.00", but it could also evaluate "0.00 LE A LE 4.00 LE > E > D". (I see that I should actually do some short-circuiting here - > if ret is false after calling fn(val1,val2), I should just break out > at that point. I'll have that fixed in the online version shortly.)
Hi, not to offend; I don't know your background. One thing I like about Python is it and the docs are careful about short-circuiting conditions. ISTR that C left some of those details up to the compiler at one point. >>> def f(): ... print( 'in f' ) ... return 10 ... >>> 0<f()<20 in f True >>> 0<f() and f()<20 in f in f True Therefore, if op{n} has side effects, 'op1 operator1 op2 AND op2 operator2 op3' is not equivalent to 'op1 optor1 op2 optor2 op3'. -- http://mail.python.org/mailman/listinfo/python-list