Removing the ordering is not a straightforward thing to do. There is
an important detail that depends on the ordering, which is that
something like x*y == y*x works because it assumes that the terms are
in canonical order, so it just compares them directly. And even
outside of __eq__ itself there may be other places that implicitly
make use of this fact. There's also a further complication which is
that for Add and Mul, any purely numeric part (i.e., the Rational or
Float term if it is nonzero) is always the first term in the args, and
many things rely on this fact.
This is a laudable change to make though. If we can somehow remove the
ordering from the core entirely (although I'm not even sure if that's
doable from a backwards compatibility point of view), it would also
improve the performance, since right now every Add and Mul that gets
created has to call sort() its arguments, which not only has to do the
sorting algorithm but it has to compute a canonical sort key for each
term. A good place to start is to look at And and Or, which go sort of
half way and don't sort their args until you actually request .args
(they also have ._argset which is a frozenset of the args).
Aaron Meurer
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/26DC4101-67E2-45A7-94A6-EA9CC094C2CE%40uwosh.edu.