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

bundles / IPython 9.12.0 / IPython / core / interactiveshell / InteractiveShell / run_ast_nodes

function

IPython.core.interactiveshell:InteractiveShell.run_ast_nodes

source: /IPython/core/interactiveshell.py :3588

Signature

async def   run_ast_nodes ( self nodelist : ListType[stmt] cell_name : str interactivity = last_expr compiler = <built-in function compile> result = None )

Summary

Run a sequence of AST nodes. The execution mode depends on the interactivity parameter.

Parameters

nodelist : list

A sequence of AST nodes to run.

cell_name : str

Will be passed to the compiler as the filename of the cell. Typically the value returned by ip.compile.cache(cell).

interactivity : str

'all', 'last', 'last_expr' , 'last_expr_or_assign' or 'none', specifying which nodes should be run interactively (displaying output from expressions). 'last_expr' will run the last node interactively only if it is an expression (i.e. expressions in loops or other blocks are not displayed) 'last_expr_or_assign' will run the last expression or the last assignment. Other values for this parameter will raise a ValueError.

compiler : callable

A function with the same interface as the built-in compile(), to turn the AST nodes into code objects. Default is the built-in compile().

result : ExecutionResult, optional

An object to store exceptions that occur during execution.

Returns

: True if an exception occurred while running code, False if it finished
: running.

Aliases

  • IPython.InteractiveShell.run_ast_nodes

Referenced by