Cell Objects¶
“Cell” objects are used to implement variables referenced by multiple scopes.For each such variable, a cell object is created to store the value; the localvariables of each stack frame that references the value contains a reference tothe cells from outer scopes which also use that variable. When the value isaccessed, the value contained in the cell is used instead of the cell objectitself. This de-referencing of the cell object requires support from thegenerated byte-code; these are not automatically de-referenced when accessed.Cell objects are not likely to be useful elsewhere.
- typePyCellObject¶
The C structure used for cell objects.
- PyTypeObjectPyCell_Type¶
The type object corresponding to cell objects.
- intPyCell_Check(PyObject*ob)¶
Return true ifob is a cell object;ob must not be
NULL
. Thisfunction always succeeds.
- PyObject*PyCell_New(PyObject*ob)¶
- Return value: New reference.
Create and return a new cell object containing the valueob. The parameter maybe
NULL
.
- PyObject*PyCell_Get(PyObject*cell)¶
- Return value: New reference.
Return the contents of the cellcell, which can be
NULL
.Ifcell is not a cell object, returnsNULL
with an exception set.
- PyObject*PyCell_GET(PyObject*cell)¶
- Return value: Borrowed reference.
Return the contents of the cellcell, but without checking thatcell isnon-
NULL
and a cell object.