Boolean(布林)物件¶
Python 中的 boolean 是以整數子類別化來實現的。只有Py_False
和Py_True
兩個 boolean。因此一般的建立和刪除函式並不適用於 boolean。但下列巨集 (macro) 是可用的。
- PyTypeObjectPyBool_Type¶
- 為穩定 ABI 的一部分.
This instance of
PyTypeObject
represents the Python boolean type; itis the same object asbool
in the Python layer.
- intPyBool_Check(PyObject*o)¶
如果o 的型別為
PyBool_Type
則回傳真值。此函式總是會成功執行。
- PyObject*Py_False¶
Python 的
False
物件。此物件沒有任何方法且為不滅的 (immortal)。
- PyObject*PyBool_FromLong(longv)¶
- 回傳值:新的參照。 為穩定 ABI 的一部分.