Objeto Célula

Objetos “Cell” são usados ​​para implementar variáveis ​​referenciadas por múltiplos escopos. Para cada variável, um objeto de célula é criado para armazenar o valor; as variáveis ​​locais de cada quadro de pilha que referencia o valor contém uma referência para as células de escopos externos que também usam essa variável. Quando o valor é acessado, o valor contido na célula é usado em vez do próprio objeto da célula. Essa des-referência do objeto da célula requer suporte do código de bytes gerado; estes não são automaticamente desprezados quando acessados. Objetos de células provavelmente não serão úteis em outro lugar.

PyCellObject

A estrutura C usada para objetos de célula.

PyTypeObject PyCell_Type

O objeto de tipo correspondente aos objetos de célula.

int PyCell_Check(ob)

Return true if ob is a cell object; ob must not be NULL.

PyObject* PyCell_New(PyObject *ob)
Return value: New reference.

Create and return a new cell object containing the value ob. The parameter may be NULL.

PyObject* PyCell_Get(PyObject *cell)
Return value: New reference.

Retorna o conteúdo da célula cell.

PyObject* PyCell_GET(PyObject *cell)
Return value: Borrowed reference.

Return the contents of the cell cell, but without checking that cell is non-NULL and a cell object.

int PyCell_Set(PyObject *cell, PyObject *value)

Set the contents of the cell object cell to value. This releases the reference to any current content of the cell. value may be NULL. cell must be non-NULL; if it is not a cell object, -1 will be returned. On success, 0 will be returned.

void PyCell_SET(PyObject *cell, PyObject *value)

Sets the value of the cell object cell to value. No reference counts are adjusted, and no checks are made for safety; cell must be non-NULL and must be a cell object.