This is why var() is not recommended except for interactive use. Aside from
doing an un-Pythonic thing (creating Python variables without using an
assignment), it can only inject variables into the global scope, due to the
way variables work in Python. This means that if you use var() inside of a
function, the variables will not be local to that function, but injected
into the global scope.

Aaron Meurer

On Tue, Aug 18, 2015 at 5:19 AM, Denis Akhiyarov <[email protected]>
wrote:

> For those who wonder why not use var() especially in combination with
> parse_expr(), the main reason I found is difficulty dealing with globals()
> and locals(). Instead of symbol injection, build your own dictionary. This
> maybe difficult to comprehend coming from interactive environment such as
> Mathematica.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/3a7290dc-11ef-489f-a848-58e2a99e7a29%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6Jzp72C%2BGoH%3DW0F93PHGHO7qMZiNEvEVNoX5Uu-JQr3ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to