Cell 物件¶
"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 local variables of each stack frame that references the value contain a reference to the cells from outer scopes which also use that variable. When the value is accessed, the value contained in the cell is used instead of the cell object itself. This de-referencing of the cell object requires support from the generated byte-code; these are not automatically de-referenced when accessed. Cell objects are not likely to be useful elsewhere.
-
type PyCellObject¶
Cell 物件所用之 C 結構。
-
PyTypeObject PyCell_Type¶
對應 cell 物件的物件型別。
-
PyObject *PyCell_Get(PyObject *cell)¶
- 回傳值:新的參照。
回傳 cell 物件 cell 的內容,其可能為
NULL。如果 cell 不是一個 cell 物件,則將回傳NULL並設定例外。
-
PyObject *PyCell_GET(PyObject *cell)¶
- 回傳值:借用參照。
回傳 cell 物件 cell 的內容,但是不檢查 cell 是否非
NULL並且為一個 cell 物件。