Le samedi 28 juillet 2012 à 10:29 -0700, Alex a écrit : > This does not change the problem: LatticeOp and AssocOp are > inconsistent. Currently the logic module understands > and handles boolean values. Either sympy needs to consistently > consider booleans as valid, first-class atoms, > either we can encapsulate these in sympy objects (kind of distasteful > in my opinion).
I agree about the need for consistency. However, sticking non-sympy objects inside sympy objects is problematic (that's a long-running debate) and True has the wrong interface anyway: In [1]: True >> True Out[1]: 0 So, encapsulating bools is the way to go, but it's hard, because there is a lot of code that relies on them not being encapsulated. > Btw, changing _sympify to sympify does not cause any issue as far as > testing is concerned, so test cases indicating wanted and unwanted > behaviors should be added. Currently, True - sympify(1) == 0 .... There's nothing we can do about that, the interpreter calls int(S(1)), which returns 1, an instance of 'int', and then computes True - 1. On the other hand: In [7]: True - x --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/ronan/dev/sympy/<ipython-input-7-58bde0218d6d> in <module>() ----> 1 True - x TypeError: unsupported operand type(s) for -: 'bool' and 'Symbol' -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
