Name
PySequence_Fast
Synopsis
PyObject* PySequence_Fast(PyObject* x
)
Returns a new reference to a tuple with the
same items as x
, unless
x
is a list, in which case returns a new
reference to x
. When you need to get many
items of an arbitrary sequence x
,
it’s fastest to call
t
=PySequence_Fast(
x
)
once, then call
PySequence_Fast_GET_ITEM(
t
,i
)
as many times as needed, and finally call
Py_DECREF(
t
)
.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.