[sympy] Re: abstract syntax tree

2011-11-12 Thread krastanov.ste...@gmail.com
This: import ast ast.parse(repr(expression)) will do the trick if repr is well coded. How much faith should I put in the repr strings in sympy? Or there is another way? On 12 November 2011 18:20, krastanov.ste...@gmail.com krastanov.ste...@gmail.com wrote: Is there any way to get the

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread Alexey U. Gudchenko
12.11.2011 21:42, krastanov.ste...@gmail.com пишет: This: import ast ast.parse(repr(expression)) will do the trick if repr is well coded. How much faith should I put in the repr strings in sympy? Or there is another way? On 12 November 2011 18:20, krastanov.ste...@gmail.com

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread Aaron Meurer
Hi. As far as I know, we don't have a function that does exactly that, though I could be wrong. It would be nice to have one, though. On Sat, Nov 12, 2011 at 11:01 AM, Alexey U. Gudchenko pr...@goodok.ru wrote: 12.11.2011 21:42, krastanov.ste...@gmail.com пишет: This: import ast

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread krastanov.ste...@gmail.com
Ok, but why are those printed differently (ipython --profile=sympy): In [34]: sin(x).func Out[34]: sympy.functions.elementary.trigonometric.sin In [35]: str(sin(x).func) Out[35]: sin In [39]: Integral(x, (x,0,1)).func Out[39]: sympy.integrals.integrals.Integral In [40]: str(Integral(x,

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread Mateusz Paprocki
Hi, On 12 November 2011 17:00, krastanov.ste...@gmail.com krastanov.ste...@gmail.com wrote: Ok, but why are those printed differently (ipython --profile=sympy): In [34]: sin(x).func Out[34]: sympy.functions.elementary.trigonometric.sin In [35]: str(sin(x).func) Out[35]: sin In [39]:

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread krastanov.ste...@gmail.com
Then I suppose I can just call a function that returns a string. Here is the problem I have: In [42]: lambdarepr(Integral(x, (x,0,1)).func) Out[42]: class 'sympy.integrals.integrals.Integral' In [43]: lambdarepr(Integral(x, (x,0,1))) Out[43]: Integral(x, (x, 0, 1)) Why is out[42] not the same

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread Mateusz Paprocki
Hi, On 12 November 2011 17:16, krastanov.ste...@gmail.com krastanov.ste...@gmail.com wrote: Then I suppose I can just call a function that returns a string. Here is the problem I have: In [42]: lambdarepr(Integral(x, (x,0,1)).func) Out[42]: class 'sympy.integrals.integrals.Integral' In

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread krastanov.ste...@gmail.com
Can the default printer be changed so lambdarepr(SomeClass(args)) and lambdarepr(SomeClass(args).func) give always the same thing. lambdarepr is using LambdaPrinter. What should be done there (or to a subclass of LambdaPrinter) to ensure the behavior that I desire? On 13 November 2011 02:21,

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread Mateusz Paprocki
Hi, On 12 November 2011 17:25, krastanov.ste...@gmail.com krastanov.ste...@gmail.com wrote: Can the default printer be changed so lambdarepr(SomeClass(args)) and lambdarepr(SomeClass(args).func) give always the same thing. lambdarepr is using LambdaPrinter. What should be done there (or to

Re: [sympy] Re: abstract syntax tree

2011-11-12 Thread krastanov.ste...@gmail.com
Thank you for the information. On 13 November 2011 02:34, Mateusz Paprocki matt...@gmail.com wrote: Hi, On 12 November 2011 17:25, krastanov.ste...@gmail.com krastanov.ste...@gmail.com wrote: Can the default printer be changed so lambdarepr(SomeClass(args)) and