[sympy] Re: navitaing though sympy expression

2010-06-22 Thread nelson
Thank you, it worked well. I can't find how in sympy i can obtain the entire expression parsing tree. I want to be able to navigate from my app, selecting part of the expression (having the expression tree and navigation functions, this would be very easy), and applying to this expression some

Re: [sympy] Re: navitaing though sympy expression

2010-06-22 Thread Aaron S. Meurer
You might look at the preorder_traversal() and postorder_traversal() functions in sympy/utilities/iterables.py: In [4]: a = (x + 2)*(x + 1)**2 In [5]: from sympy.utilities.iterables import preorder_traversal, postorder_traversal In [6]: preorder_traversal(a) Out[6]: generator object