sympify() works independently of what you already have defined. So for
instance,
x = 1
print(sympify('x')) # prints x
This produce Symbol('x'), not 1. If you want it to use what you
already have defined, you can pass locals() as the second argument to
sympify()
x = 1
print(sympify('x', locals()) # prints 1
The best recommendation is in general to avoid sympify, unless you are
processing arbitrary strings. Instead, build your expression up
directly using Python operations, like in your first examples.
Aaron Meurer
> --
> 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
sympy+un...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/5d9325aa-6eb4-4340-af0d-5e0f3a93c419%40googlegroups.com.