Interesting.

You need to fix some doctests.  For example, the fix_missing_locations
used in the convert() method docstring isn't imported.

I think perhaps your convert methods should be class methods.

On Thu, Sep 8, 2011 at 7:53 AM, Dimas Abreu Dutra <[email protected]> wrote:
> Hello all,
>
> I created a class to generate an abstract syntax tree from sympy
> expressions. Operations like addition, subtraction and power are
> converted to the python operator. Symbols are converted to identifiers
> (Name nodes) and functions to calls.
>
> It contrasts with the python printer because it does not generate
> sympy code. The python printer pretty much just creates code that
> evaluates to the same sympy expression that was used for generation.
> So symbols are converted to Symbol constructors and rationals are
> converted to Rational constructors. With the AST, the duck typing can
> be used and if the variables and functions are appropriately defined
> and imported, an expression can be evaluated with numpy arrays, which
> is what I want to use it for.
>
> The most useful thing, though, is generation of function def nodes,
> which can be compiled and used more easily (and safely, without any
> weird side effects) to take advantage of duck typing.
>
> The code is in my personal repository which houses arbitrary python
> stuff that I'm working on:
>
>      
> https://github.com/dimasad/scikits.dimas/blob/master/scikits/dimas/pycode.py
>
> I guess that could be a useful addition to sympy, and other people
> might need it as well. I was thinking it could be included as a module
> in the sympy.parsing package. I'm not sure about the name, though,
> perhaps sympy_ast or ast_builder. I'm still working on it, though, so
> maybe I could send a pull request when I'm done.

Yes, please do.

Aaron Meurer

>
> ~Dimas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to