Le samedi 28 mai 2011 à 05:14 -0700, Vinzent Steinberg a écrit : > On 27 Mai, 21:53, Ronan Lamy <[email protected]> wrote: > > That should be true as well - repr is supposed to behave like that. And > > it's easy to implement: just define the __repr__ method to return the > > right thing. > > For sure it is trivial to implement, but whether it is the right thing > is arguable. Personally, I surely don't want for example such > behavior: > > >>> [x**4 - x**3*y - x*y**3 + y**4] > [Add(Mul(Integer(-1), Symbol('x'), Pow(Symbol('y'), Integer(3))), > Mul(Integer(-1), Symbol('y'), Pow(Symbol('x'), Integer(3) > )), Pow(Symbol('x'), Integer(4)), Pow(Symbol('y'), Integer(4)))]
I don't care about that, because we don't put stuff inside containers that often, because I usually want the repr when I look at .args, and because the only shell I really care about is ipython, which prints this nicely in any case. > > > > In SymPy repr() == str() == sstr(). This has to work like this due to > > > a bug in Python (see issue 2388 for more details). > > > > What you mention is apparently a feature in Python, not a bug. > > Well, call it "unwanted feature" if you prefer. What matters is that: * we can't change it * people new to sympy who know Python expect it * there is a lot of code outside sympy that takes this behaviour for granted and works with/around it. -- 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.
