You are viewing an older version (9.12.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.12.0 / IPython / utils / frame / extract_vars

function

IPython.utils.frame:extract_vars

source: /IPython/utils/frame.py :27

Signature

def   extract_vars ( * names : str ** kw : Any )  →  dict[str, Any]

Summary

Extract a set of variables by name from another frame.

Parameters

*names : str

One or more variable names which will be extracted from the caller's frame.

**kw : integer, optional

How many frames in the stack to walk when looking for your variables. The default is 0, which will use the frame where the call was made.

Examples

:: In [2]: def func(x): ...: y = 1 ...: print(sorted(extract_vars('x','y').items())) ...: In [3]: func('hello') [('x', 'hello'), ('y', 1)]

Aliases

  • IPython.utils.frame.extract_vars