On Nov 22, 2012, at 10:41 AM, David Li <[email protected]> wrote:

Hello,

I have been working on the API for parse_expr after having implemented
implicit multiplication, and would like your thoughts on my proposed
changes. Currently in a local branch I have this:

   - stringify_expr parses the input and returns a string (this will be
   useful for Gamma)
   - eval_expr evaluates the input
   - parse_expr combines the two for convenience/compatibility

Sounds good.

The first two functions require a dictionary of globals; after seeing the
discussion at PR 1648 <https://github.com/sympy/sympy/pull/1648>, would it
be a good idea to add that option to parse_expr as well?


Yes.


I have also changed the usage of implicit multiplication/other
transformations to make it more convenient. Before the usage was

transformations = standard_transformations + (convert_xor,
implicit_multiplication_application)

and now it is

transformations = (standard_transformations, convert_xor,
implicit_multiplication_application)

as I have changed standard_transformations from being a tuple of functions
to apply to a function. This doesn't save much typing, but it is cleaner.


What exactly was the tuple before?


sympify's API is not changed at all - as this is much more used, I don't
want to break compatibility.


This is a good idea.


Some examples can be found in the tests of
sympy_parser<https://github.com/lidavidm/sympy/blob/sympify_issues_and_refactoring/sympy/parsing/tests/test_sympy_parser.py>and
implicit
multiplication<https://github.com/lidavidm/sympy/blob/sympify_issues_and_refactoring/sympy/parsing/tests/test_implicit_multiplication_application.py>and
in the docstring
for 
parse_expr<https://github.com/lidavidm/sympy/blob/sympify_issues_and_refactoring/sympy/parsing/sympy_parser.py#L569>
.

Additionally, I have fixed
#2663<https://code.google.com/p/sympy/issues/detail?id=2663>and
#3423 <https://code.google.com/p/sympy/issues/detail?id=3423>. Both were
due to the automatic conversion of variables into symbols without taking
into account context.


Did you also fix comment 3 of 2663?

Can you make your fix generalized to an API?  I need this exact same fix to
change isympy -a to use parsing.

Aaron Meurer


Are these changes acceptable? Also, does anyone have other ideas?

Thank you,
David

-- 
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