@@ -130,19 +130,26 @@ Sequence Protocol
130
130
131
131
.. c :function :: PyObject* PySequence_Fast (PyObject *o, const char *m)
132
132
133
- Return the sequence or iterable *o * as a list, unless it is already a tuple or list, in
134
- which case *o * is returned. Use :c:func: `PySequence_Fast_GET_ITEM ` to access
135
- the members of the result. Returns *NULL * on failure. If the object is not
136
- a sequence or iterable, raises :exc: `TypeError ` with *m * as the message text.
133
+ Return the sequence or iterable *o * as an object usable by the other
134
+ ``PySequence_Fast* `` family of functions. If the object is not a sequence or
135
+ iterable, raises :exc: `TypeError ` with *m * as the message text. Returns
136
+ *NULL * on failure.
137
+
138
+ The ``PySequence_Fast* `` functions are thus named because they assume
139
+ *o * is a :c:type: `PyTupleObject ` or a :c:type: `PyListObject ` and access
140
+ the data fields of *o * directly.
141
+
142
+ As a CPython implementation detail, if *o * is already a sequence or list, it
143
+ will be returned.
137
144
138
145
139
146
.. c :function :: Py_ssize_t PySequence_Fast_GET_SIZE (PyObject *o)
140
147
141
148
Returns the length of *o *, assuming that *o * was returned by
142
149
:c:func: `PySequence_Fast ` and that *o * is not *NULL *. The size can also be
143
150
gotten by calling :c:func: `PySequence_Size ` on *o *, but
144
- :c:func: `PySequence_Fast_GET_SIZE ` is faster because it can assume *o * is a list
145
- or tuple.
151
+ :c:func: `PySequence_Fast_GET_SIZE ` is faster because it can assume *o * is a
152
+ list or tuple.
146
153
147
154
148
155
.. c :function :: PyObject* PySequence_Fast_GET_ITEM (PyObject *o, Py_ssize_t i)
@@ -163,7 +170,7 @@ Sequence Protocol
163
170
164
171
.. c :function :: PyObject* PySequence_ITEM (PyObject *o, Py_ssize_t i)
165
172
166
- Return the *i *\ th element of *o * or *NULL * on failure. Macro form of
173
+ Return the *i *\ th element of *o * or *NULL * on failure. Faster form of
167
174
:c:func: `PySequence_GetItem ` but without checking that
168
175
:c:func: `PySequence_Check ` on *o * is true and without adjustment for negative
169
176
indices.
0 commit comments