Runtime Types

types.CellType — runtime type

A cell is a container used to share a closure variable between nested functions. A function closure contains cells, not copies of the values. Inspect cell_contents; an empty cell raises ValueError on read. Prefer normal closure syntax rather than editing cells to implement application state.

Formal Syntax & Structure

python syntaxpython
types.CellType

Return Value

type

The class object types.CellType; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
import typesdef outer():    x=7    return lambda: xf=outer()value = f.__closure__[0]print(isinstance(value, types.CellType))
Python Reference