集对象 ¶
This section details the public API for
set
and
frozenset
objects. Any functionality not listed below is best accessed using either the abstract object protocol (including
PyObject_CallMethod()
,
PyObject_RichCompareBool()
,
PyObject_Hash()
,
PyObject_Repr()
,
PyObject_IsTrue()
,
PyObject_Print()
,和
PyObject_GetIter()
) or the abstract number protocol (including
PyNumber_And()
,
PyNumber_Subtract()
,
PyNumber_Or()
,
PyNumber_Xor()
,
PyNumber_InPlaceAnd()
,
PyNumber_InPlaceSubtract()
,
PyNumber_InPlaceOr()
,和
PyNumber_InPlaceXor()
).
-
type
PySetObject
¶
-
此子类型的
PyObjectis used to hold the internal data for bothsetandfrozensetobjects. It is like aPyDictObjectin that it is a fixed size for small sets (much like tuple storage) and will point to a separate, variable sized block of memory for medium and large sized sets (much like list storage). None of the fields of this structure should be considered public and all are subject to change. All access should be done through the documented API rather than by manipulating the values in the structure.
-
PyTypeObject
PySet_Type
¶
-
属于
稳定 ABI (应用程序二进制接口)
.
This is an instance of
PyTypeObjectrepresenting the Pythonset类型。
-
PyTypeObject
PyFrozenSet_Type
¶
-
属于
稳定 ABI (应用程序二进制接口)
.
This is an instance of
PyTypeObjectrepresenting the Pythonfrozenset类型。
The following type check macros work on pointers to any Python object. Likewise, the constructor functions work with any iterable Python object.
-
int
PySet_Check
(
PyObject
*
p
)
¶
-
返回 True 若 p 是
setobject or an instance of a subtype. This function always succeeds.
-
int
PyFrozenSet_Check
(
PyObject
*
p
)
¶
-
返回 True 若 p 是
frozensetobject or an instance of a subtype. This function always succeeds.