I'm assuming you're wondering how var() injects names into its calling namespace. See https://github.com/sympy/sympy/blob/master/sympy/core/symbol.py#L465. It uses inspect.currentframe().
And the usual disclaimer: the use of var() (or a similar function) is considered bad style, because it does magic and decreases readability. Furthermore, I believe there are some situations where var() doesn't work, because inspect.currentframe is not perfect (an in particular it might not work in alternative Python implementations from CPython). Also the try, finally is very important. See the inspect documentation. Aaron Meurer On Sun, Oct 27, 2013 at 1:52 AM, Christophe Bal <[email protected]> wrote: > Hello, > sorry for this little out of scope question. > > What is used internally so as to build x with vars('x') ? > > Christophe > > -- > 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. -- 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.
