### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# core.compilerop

## Module: `core.compilerop`

Inheritance diagram for `IPython.core.compilerop`:

Compiler tools with improved interactive support.

Provides compilation machinery similar to codeop, but with caching support so we can provide interactive tracebacks.

### Authors

- Robert Kern
- Fernando Perez
- Thomas Kluyver

## `CachingCompiler`

class `IPython.core.compilerop.``CachingCompiler`

  Bases: `codeop.Compile`

  A compiler that caches code compiled from interactive statements.

  `__init__`()
  `cache`(code, number=0)

    Make a name for a block of code, and cache the code.

    Parameters : | code : str The Python source code to cache. number : int A number which forms part of the code’s name. Used for the execution counter.
    Returns : | The name of the cached code (as a string). Pass this as the filename : argument to compilation, so that tracebacks are correctly hooked up. :

  `check_cache`(*args)

    Call linecache.checkcache() safely protecting our cached values.

  `compiler_flags`

    Flags currently active in the compilation process.

`IPython.core.compilerop.``code_name`(code, number=0)

  Compute a (probably) unique name for code for caching.

  This now expects code to be unicode.

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »