Status: Valid
Owner: ----
Labels: Type-Enhancement Priority-Medium Printing

New issue 3613 by [email protected]: Save the order that an expression was entered
http://code.google.com/p/sympy/issues/detail?id=3613

If you enter b*c*a, the original order, (b, c, a), is completely lost. The order in Mul's args is canonicalized, and the printing order is computed just by sorting alphabetically. But it would be nice to be able to print expressions exactly as they were entered. This shouldn't be too hard, but there are some subtleties I can foresee:

- We want to make sure this is general (i.e., put it on Basic, not Mul). But not all classes are commutative.

- We want this to be part of the class, but not part of the equality comparison, so that x*y == y*x still compares true.

- We want it to inherit. So Mul(Mul(x, y), z) has the same order as Mul(x, y, z).

- We need it to work correctly with __op__ and __rop__.

- Probably the most important, it should not slow down the core. If it makes things slow, we could disable it by default, but allow people to enable it (e.g., when enabling the printing option that prints expressions as they are entered).

Of course, if we got this to work, there would be the caveat that just about any SymPy function could rearrange the order that an expression is printed in, because there is no guarantee that it will manipulate an expression in the same order that it was originally built.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to