environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py
def var_expand(self, cmd, depth=0, formatter=DollarFormatter()):
        """Expand python variables in a string.

        The depth argument indicates how many frames above the caller should
        be walked to look for the local namespace where to expand variables.

        The global namespace for expansion is always the user's interactive
        namespace.
        """
        ns = self.user_ns.copy()
        ns.update(sys._getframe(depth+1).f_locals)
        ns.pop('self', None)
        try:
            cmd = formatter.format(cmd, **ns)
        except Exception:
            # if formatter couldn't format, just let it go untransformed
            pass
        return cmd
def var_expand(self, cmd, depth=0, formatter=DollarFormatter()):
        """Expand python variables in a string.

        The depth argument indicates how many frames above the caller should
        be walked to look for the local namespace where to expand variables.

        The global namespace for expansion is always the user's interactive
        namespace.
        """
        ns = self.user_ns.copy()
        ns.update(sys._getframe(depth+1).f_locals)
        ns.pop('self', None)
        try:
            cmd = formatter.format(cmd, **ns)
        except Exception:
            # if formatter couldn't format, just let it go untransformed
            pass
        return cmd
Expand python variables in a string.

        The depth argument indicates how many frames above the caller should
        be walked to look for the local namespace where to expand variables.

        The global namespace for expansion is always the user's interactive
        namespace.