Hello,
I noticed that passing an invalid mathematical expression causes a
SyntaxError (Python exception). For eg:
>>> parse_expr('2*x*x')
results in:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.3/site-packages/sympy/parsing/sympy_parser.py",
line 164, in parse_expr
expr = eval(code, global_dict, local_dict) # take local objects in
preference
File "<string>", line 1
Integer (2 )*Symbol ('x' )*Symbol ('x' )+Integer (2 )Symbol ('x' )
^
SyntaxError: invalid syntax
I also understand why, since we are basically 'eval' ing:
"Integer (2 )*Symbol ('x' )*Symbol ('x' )+Integer (2 )Symbol ('x' )"
Shouldn't this be raised as a separate exception class from SymPy (on
the lines of class sympy.parsing.sympy_tokenize.TokenError, for
example)?
Best,
Amit.
--
http://echorand.me
--
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 http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.