Maybe we could add a *precedence_traditional* method to the precedence module, that is supposed to provide the precedence according to traditional-styled math representation (e.g. *Integral* in traditional precedence would have the same precedence as *Mul*, not as *atom*).
At this point, the pretty printer and the latex printer could have an abstract superclass dealing with parenthesization. On Friday, 1 April 2016 17:40:07 UTC+2, Aaron Meurer wrote: > > But it's not working well. There are several issues with things that > don't get parenthesized correctly (I know you know about these, > because you made pull requests to fix them). How many other things are > also missing parentheses? It seems to me that any object that the > printer doesn't expect that requires parentheses won't get > parenthesized correctly. > > Also, the pretty printer has tons of tests. I'm fairly confident that > any issues from small refactor like this would be caught in the tests. > We can also double check the test coverage if you're worried about > that. > > Aaron Meurer > > > On Fri, Apr 1, 2016 at 9:20 AM, Francesco Bonazzi > <franz....@gmail.com <javascript:>> wrote: > > > > > > On Thursday, 31 March 2016 17:51:33 UTC+2, Aaron Meurer wrote: > >> > >> > >> I've noticed that the LaTeX printer and the pretty printer have > >> different methods for computing parenthesization (the LaTeX method > >> seems to be better). This is likely the cause of this. We should unify > >> the two. > > > > > > The problem here is that the current code is working well. I agree that > > there's repeating coding that could be unified and made more reliant on > the > > precedence module. > > > > But... why would we need to spend time to rewrite code that is already > > working well? > > > > -- > > 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 sympy+un...@googlegroups.com <javascript:>. > > To post to this group, send email to sy...@googlegroups.com > <javascript:>. > > Visit this group at https://groups.google.com/group/sympy. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/sympy/f2f1ace8-c316-49da-b766-1702aa39fa84%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/8fddb66c-39e6-4459-95ca-08c43378a244%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.