Comment #7 on issue 2960 by asmeu...@gmail.com: It right 0 < x < 1 ?
http://code.google.com/p/sympy/issues/detail?id=2960

Exactly. This is why I personally think that PEP 335 should be replaced with a way to override short-circuit semantics.

(a < b) < c is wrong. This creates Lt(Lt(a, b), c), which is not what we want. It's unfortunate that we currently allow this, and that the printer makes it look correct. This should be fixed. Issue 1887 comes up again.

(a < b) < c should be made to return And(Lt(a, b), Lt(b, c)) (we can make the printer smart enough to print it as a < b < c (or maybe as (a < b) < c). Unfortunately, currently this won't work with greater thans, because Gt(a, b) is currently transformed into Lt(b, a). This needs to also be fixed. Again, with all of these Relational rewriting suggestions, I point to issue 1887.

So, to summarize, the following issues will have to fixed to make this work:

- Nested relationals are allowed. They should create And classes (or at least __lt__ should, we can debate if direct calls to the class like Lt(Lt(a, b), c) should as well).

- Inequalities are canonicalized into less thans. This would prevent (a > b) > c from working.

- bool(Relational) works (issue 2832), making it appear as if x < y < z should work (and giving surprising results).

- The printer should be fixed to print things like And(a < b, b < c) as a < b < c (or (a < b) < c for the string printer).

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to