On Apr 17, 1:26 pm, Aaron Brady <castiro...@gmail.com> wrote: > Hi, not to offend; I don't know your background.
Courtesy on Usenet!!! I'm going to go buy a lottery ticket! Not to worry, I'm a big boy. People have even called my baby ugly, and I manage to keep my blood pressure under control. > 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'. Interesting point, but I don't remember that "A < B < C" is valid C syntax, are you perhaps thinking of a different language? By luck, my implementation of EvalComparisonOp.eval does in fact capture the post-eval value of op2, so that if its evaluation caused any side effects, they would not be repeated. -- Paul -- http://mail.python.org/mailman/listinfo/python-list