Yes, that is basically the idea I had at https://code.google.com/p/sympy/issues/detail?id=3736#c3. I think it's probably the best way to do it in general.
Aaron Meurer On Fri, Nov 29, 2013 at 11:56 AM, Pablo Puente <[email protected]> wrote: > Maybe a UnevaluatedExpression wrapper class could ensure the inside > expression is not evaluated. > > > On Wednesday, November 20, 2013 4:26:59 AM UTC+1, Aaron Meurer wrote: >> >> Yes, unfortunately, unevaluated expressions tend to be "unstable". >> Sometimes things will do what would normally be an innocuous >> transformation that ends up evaluating it. These bugs have been mostly >> fixed for the pretty printer, but I guess they are still there for the >> latex printer. >> >> Aaron Meurer >> >> On Mon, Nov 18, 2013 at 4:30 AM, <[email protected]> wrote: >> > Hi, >> > >> > I work with unevaluated Adds and Muls and today found this: >> > >> >>>> from sympy import latex, Mul, Symbol >> >>>> x = Symbol('x') >> >>>> e = Mul(-2, x + 1, evaluate=False) >> >>>> print e >> > -2*(x + 1) >> >>>> print latex(e) >> > - 2 x + 2 >> > >> > The first print is correct but the second one is not. It's not about >> > simply >> > dropping parentheses when they are needed. In that case the second print >> > would read - 2 x + 1 so some computation took place. >> > >> > Regards >> > -- >> > Greg >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at http://groups.google.com/group/sympy. >> > For more options, visit https://groups.google.com/groups/opt_out. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
