Le samedi 28 juillet 2012 à 01:04 -0700, Alex a écrit : > > > On Saturday, July 28, 2012 12:57:01 AM UTC-7, Aaron Meurer wrote: > On Fri, Jul 27, 2012 at 11:32 PM, Alex > <[email protected]> wrote: > > There are some discrepancies between the two classes, and > I'm not exactly > > sure why. > > > > - AssocOp sympifies arguments in strict mode via _sympify > (which is > > anyway just a proxy for sympify(., strict=True) -- is it > reasonable to have > > a separate function > > for doing just this?). Anyway, this is an issue when dealing > with booleans: > > Xor(True, A) breaks as booleans are obviously not converted. > LatticeOp uses > > sympify. > > Booleans won't be converted with anything, as we don't have > Basic > boolean literal types. > > > I'm totally fine with that. I'm just arguing that AssocOp should use > simplify instead of _symplify, > and that _symplify might need to go away.
I guess you mean sympify, not simplify. There are basically two problems with using sympify instead of _sympify: * sympify parses strings, which messes up the interface (we don't want to allow 'x*y' + z), and can trigger arbitrary computation. * sympy handles 'True' and '1' very differently, but for Python they are nearly the same (e.g. True - 1 == 0). Letting bool objects through would cause trouble in arithmetic contexts. -- 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.
