This is a development version (latest) and may be unstable. Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython latest / IPython / core / interactiveshell / InteractiveShell / prepare_user_module

function

IPython.core.interactiveshell:InteractiveShell.prepare_user_module

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

Signature

def   prepare_user_module ( self user_module = None user_ns = None )

Summary

Prepare the module and namespace in which user code will be run.

Extended Summary

When IPython is started normally, both parameters are None: a new module is created automatically, and its __dict__ used as the namespace.

If only user_module is provided, its __dict__ is used as the namespace. If only user_ns is provided, a dummy module is created, and user_ns becomes the global namespace. If both are provided (as they may be when embedding), user_ns is the local namespace, and user_module provides the global namespace.

Parameters

user_module : module, optional

The current user module in which IPython is being run. If None, a clean module will be created.

user_ns : dict, optional

A namespace in which to run interactive commands.

Returns

: A tuple of user_module and user_ns, each properly initialised.

Aliases

  • IPython.InteractiveShell.prepare_user_module