It is possible to canonically order Symbols, but that order is completely arbitrary, and might not be what the user expects. It's best to require the user to specify the symbol order, so there is no ambiguity.
Aaron Meurer On Wed, Jan 25, 2017 at 1:15 PM, Mohit Raj <[email protected]> wrote: > Hey all, > I would like to have any valuable suggestions on this code below. > It is maintaining order of variables. I think preorder_traversal would also > work. > Kindly do give suggestions on this. > > if fargs is None: > fargs = [ ] > seen = [ ] > out = [ ] > for i in f: > temp = i.as_ordered_terms() > for j in temp: > if(isinstance(j,Symbol)): > out.append(j) > for m in out: > if m not in seen: > fargs.append(m) > seen.append(m) > > -- > 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 https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/aebf0986-021b-4774-8c8a-a946d3d4f11a%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 [email protected]. To post to this group, send email to [email protected]. 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/CAKgW%3D6LAqVM-4jYmEYB-Ed9D10hf%2BstUkFUHUYXfMrtDDMEoWA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
