Module: core.builtin_trap — IPython 4.0.0 documentation

# Module: `core.builtin_trap`

A context manager for managing things injected into `__builtin__`.

Authors:

- Brian Granger
- Fernando Perez

## 1 Class

class `IPython.core.builtin_trap.` `BuiltinTrap`(shell=None)

  Bases: `traitlets.config.configurable.Configurable`

  `__init__`(shell=None)
  `activate`()

    Store ipython references in the __builtin__ namespace.

  `add_builtin`(key, value)

    Add a builtin and save the original.

  `deactivate`()

    Remove any builtins which might have been added by add_builtins, or restore overwritten ones to their previous values.

  `remove_builtin`(key, orig)

    Remove an added builtin and re-set the original.