Changeset 391 for python/trunk/Doc/c-api/set.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/c-api/set.rst
r2 r391 17 17 This section details the public API for :class:`set` and :class:`frozenset` 18 18 objects. Any functionality not listed below is best accessed using the either 19 the abstract object protocol (including :c func:`PyObject_CallMethod`,20 :c func:`PyObject_RichCompareBool`, :cfunc:`PyObject_Hash`,21 :c func:`PyObject_Repr`, :cfunc:`PyObject_IsTrue`, :cfunc:`PyObject_Print`, and22 :c func:`PyObject_GetIter`) or the abstract number protocol (including23 :c func:`PyNumber_And`, :cfunc:`PyNumber_Subtract`, :cfunc:`PyNumber_Or`,24 :c func:`PyNumber_Xor`, :cfunc:`PyNumber_InPlaceAnd`,25 :c func:`PyNumber_InPlaceSubtract`, :cfunc:`PyNumber_InPlaceOr`, and26 :c func:`PyNumber_InPlaceXor`).19 the abstract object protocol (including :c:func:`PyObject_CallMethod`, 20 :c:func:`PyObject_RichCompareBool`, :c:func:`PyObject_Hash`, 21 :c:func:`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:`PyObject_Print`, and 22 :c:func:`PyObject_GetIter`) or the abstract number protocol (including 23 :c:func:`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, 24 :c:func:`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, 25 :c:func:`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, and 26 :c:func:`PyNumber_InPlaceXor`). 27 27 28 28 29 .. c type:: PySetObject29 .. c:type:: PySetObject 30 30 31 This subtype of :c type:`PyObject` is used to hold the internal data for both32 :class:`set` and :class:`frozenset` objects. It is like a :c type:`PyDictObject`31 This subtype of :c:type:`PyObject` is used to hold the internal data for both 32 :class:`set` and :class:`frozenset` objects. It is like a :c:type:`PyDictObject` 33 33 in that it is a fixed size for small sets (much like tuple storage) and will 34 34 point to a separate, variable sized block of memory for medium and large sized … … 38 38 39 39 40 .. c var:: PyTypeObject PySet_Type40 .. c:var:: PyTypeObject PySet_Type 41 41 42 This is an instance of :c type:`PyTypeObject` representing the Python42 This is an instance of :c:type:`PyTypeObject` representing the Python 43 43 :class:`set` type. 44 44 45 45 46 .. c var:: PyTypeObject PyFrozenSet_Type46 .. c:var:: PyTypeObject PyFrozenSet_Type 47 47 48 This is an instance of :c type:`PyTypeObject` representing the Python48 This is an instance of :c:type:`PyTypeObject` representing the Python 49 49 :class:`frozenset` type. 50 50 … … 53 53 54 54 55 .. c function:: int PySet_Check(PyObject *p)55 .. c:function:: int PySet_Check(PyObject *p) 56 56 57 57 Return true if *p* is a :class:`set` object or an instance of a subtype. … … 59 59 .. versionadded:: 2.6 60 60 61 .. c function:: int PyFrozenSet_Check(PyObject *p)61 .. c:function:: int PyFrozenSet_Check(PyObject *p) 62 62 63 63 Return true if *p* is a :class:`frozenset` object or an instance of a … … 66 66 .. versionadded:: 2.6 67 67 68 .. c function:: int PyAnySet_Check(PyObject *p)68 .. c:function:: int PyAnySet_Check(PyObject *p) 69 69 70 70 Return true if *p* is a :class:`set` object, a :class:`frozenset` object, or an … … 72 72 73 73 74 .. c function:: int PyAnySet_CheckExact(PyObject *p)74 .. c:function:: int PyAnySet_CheckExact(PyObject *p) 75 75 76 76 Return true if *p* is a :class:`set` object or a :class:`frozenset` object but … … 78 78 79 79 80 .. c function:: int PyFrozenSet_CheckExact(PyObject *p)80 .. c:function:: int PyFrozenSet_CheckExact(PyObject *p) 81 81 82 82 Return true if *p* is a :class:`frozenset` object but not an instance of a … … 84 84 85 85 86 .. c function:: PyObject* PySet_New(PyObject *iterable)86 .. c:function:: PyObject* PySet_New(PyObject *iterable) 87 87 88 88 Return a new :class:`set` containing objects returned by the *iterable*. The … … 93 93 94 94 95 .. c function:: PyObject* PyFrozenSet_New(PyObject *iterable)95 .. c:function:: PyObject* PyFrozenSet_New(PyObject *iterable) 96 96 97 97 Return a new :class:`frozenset` containing objects returned by the *iterable*. … … 109 109 110 110 111 .. c function:: Py_ssize_t PySet_Size(PyObject *anyset)111 .. c:function:: Py_ssize_t PySet_Size(PyObject *anyset) 112 112 113 113 .. index:: builtin: len … … 118 118 119 119 .. versionchanged:: 2.5 120 This function returned an :c type:`int`. This might require changes in120 This function returned an :c:type:`int`. This might require changes in 121 121 your code for properly supporting 64-bit systems. 122 122 123 123 124 .. c function:: Py_ssize_t PySet_GET_SIZE(PyObject *anyset)124 .. c:function:: Py_ssize_t PySet_GET_SIZE(PyObject *anyset) 125 125 126 Macro form of :c func:`PySet_Size` without error checking.126 Macro form of :c:func:`PySet_Size` without error checking. 127 127 128 128 129 .. c function:: int PySet_Contains(PyObject *anyset, PyObject *key)129 .. c:function:: int PySet_Contains(PyObject *anyset, PyObject *key) 130 130 131 131 Return 1 if found, 0 if not found, and -1 if an error is encountered. Unlike … … 136 136 137 137 138 .. c function:: int PySet_Add(PyObject *set, PyObject *key)138 .. c:function:: int PySet_Add(PyObject *set, PyObject *key) 139 139 140 140 Add *key* to a :class:`set` instance. Does not apply to :class:`frozenset` … … 146 146 .. versionchanged:: 2.6 147 147 Now works with instances of :class:`frozenset` or its subtypes. 148 Like :c func:`PyTuple_SetItem` in that it can be used to fill-in the148 Like :c:func:`PyTuple_SetItem` in that it can be used to fill-in the 149 149 values of brand new frozensets before they are exposed to other code. 150 150 … … 153 153 154 154 155 .. c function:: int PySet_Discard(PyObject *set, PyObject *key)155 .. c:function:: int PySet_Discard(PyObject *set, PyObject *key) 156 156 157 157 Return 1 if found and removed, 0 if not found (no action taken), and -1 if an 158 158 error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a 159 :exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:` discard`159 :exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard` 160 160 method, this function does not automatically convert unhashable sets into 161 161 temporary frozensets. Raise :exc:`PyExc_SystemError` if *set* is an not an … … 163 163 164 164 165 .. c function:: PyObject* PySet_Pop(PyObject *set)165 .. c:function:: PyObject* PySet_Pop(PyObject *set) 166 166 167 167 Return a new reference to an arbitrary object in the *set*, and removes the … … 171 171 172 172 173 .. c function:: int PySet_Clear(PyObject *set)173 .. c:function:: int PySet_Clear(PyObject *set) 174 174 175 175 Empty an existing set of all elements.
Note:
See TracChangeset
for help on using the changeset viewer.