(names, **args)
return syms
Create symbols and inject them into the global namespace.

    This calls :func:`symbols` with the same arguments and puts the results
    into the *global* namespace. It's recommended not to use :func:`var` in
    library code, where :func:`symbols` has to be used::

        >>> from sympy import var

        >>> var('x')
        x
        >>> x
        x

        >>> var('a,ab,abc')
        (a, ab, abc)
        >>> abc
        abc

        >>> var('x,y', real=True)
        (x, y)
        >>> x.is_real and y.is_real
        True

    See :func:`symbol` documentation for more details on what kinds of
    arguments can be passed to :func:`var`.
Create symbols and inject them into the global namespace.
Create symbols and inject them into the global namespace .
def var(names, **args):
    """
    Create symbols and inject them into the global namespace.

    This calls :func:`symbols` with the same arguments and puts the results
    into the *global* namespace. It's recommended not to use :func:`var` in
    library code, where :func:`symbols` has to be used::

        >>> from sympy import var

        >>> var('x')
        x
        >>> x
        x

        >>> var('a,ab,abc')
        (a, ab, abc)
        >>> abc
        abc

        >>> var('x,y', real=True)
        (x, y)
        >>> x.is_real and y.is_real
        True

    See :func:`symbol` documentation for more details on what kinds of
    arguments can be passed to :func:`var`.

    """
    def traverse(symbols, frame):
        """Recursively inject symbols to the global namespace. """
        for symbol in symbols:
            if isinstance(symbol, Basic):
                frame.f_globals[symbol.name] = symbol
            elif isinstance(symbol, FunctionClass):
                frame.f_globals[symbol.__name__] = symbol
            else:
                traverse(symbol, frame)

    from inspect import currentframe
    frame = currentframe().f_back

    try:
        syms = symbols(names, **args)

        if syms is not None:
            if isinstance(syms, Basic):
                frame.f_globals[syms.name] = syms
            elif isinstance(syms, FunctionClass):
                frame.f_globals[syms.__name__] = syms
            else:
                traverse(syms, frame)
    finally:
        del frame  # break cyclic dependencies as stated in inspect docs

    return syms
def var ( names , * * args ) : def traverse ( symbols , frame ) : """Recursively inject symbols to the global namespace. """ for symbol in symbols : if isinstance ( symbol , Basic ) : frame . f_globals [ symbol . name ] = symbol elif isinstance ( symbol , FunctionClass ) : frame . f_globals [ symbol . __name__ ] = symbol else : traverse ( symbol , frame ) from inspect import currentframe frame = currentframe ( ) . f_back try : syms = symbols ( names , * * args ) if syms is not None : if isinstance ( syms , Basic ) : frame . f_globals [ syms . name ] = syms elif isinstance ( syms , FunctionClass ) : frame . f_globals [ syms . __name__ ] = syms else : traverse ( syms , frame ) finally : del frame # break cyclic dependencies as stated in inspect docs return syms