The following code is not working as I expected.
Why does Sym1 contain an underline (_{1})?
Why does return fail (unhandled exception) in line 7?
Code:
import sympy
from sympy import symbols, latex
def defSym1():
return Sym1
def defSym2():
strSym = 'return Sym2'
exec(strSym)
Sym1 = symbols('Sym1')
Sym2 = symbols('Sym2')
print(latex(defSym1()))
print(latex(defSym2()))
print('end testSym')
Output:
Sym_{1}
'return' outside function (<string>, line 1)
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/4a1df466-d3a3-4f7b-8a14-5e5a906f2662n%40googlegroups.com.