Source

opycaml / sequence.idl.in

// ------------------------- Sequence protocol

boolean PySequence_Check(PyObject  *o);
// Return 1 if the object provides sequence protocol, and 0 otherwise. This function always succeeds.

size_or_fail PySequence_Size(PySequenceObject *o);
size_or_fail PySequence_Length(PySequenceObject *o);
// Returns the number of objects in sequence o on success, and -1 on failure. For objects that do not provide sequence protocol, this is equivalent to the Python expression len(o).

[new] PySequenceObject* PySequence_Concat(PySequenceObject *o1, PySequenceObject *o2);
// Return value: New reference.
// Return the concatenation of o1 and o2 on success, and NULL on failure. This is the equivalent of the Python expression o1 + o2.

[new] PySequenceObject* PySequence_Repeat(PySequenceObject *o, Py_ssize_t count);
// Return value: New reference.
// Return the result of repeating sequence object o count times, or NULL on failure. This is the equivalent of the Python expression o * count.

[new] PySequenceObject* PySequence_InPlaceConcat(PySequenceObject *o1, PySequenceObject *o2);
// Return value: New reference.
// Return the concatenation of o1 and o2 on success, and NULL on failure. The operation is done in-place when o1 supports it. This is the equivalent of the Python expression o1 += o2.

[new] PySequenceObject* PySequence_InPlaceRepeat(PySequenceObject *o, Py_ssize_t count);
// Return value: New reference.
// Return the result of repeating sequence object o count times, or NULL on failure. The operation is done in-place when o supports it. This is the equivalent of the Python expression o *= count.

[new] PyObject* PySequence_GetItem(PySequenceObject *o, Py_ssize_t i); [mlname getItemPos]
// Return value: New reference.
// Return the ith element of o, or NULL on failure. This is the equivalent of the Python expression o[i].

[new] PySliceObject* PySequence_GetSlice(PySequenceObject *o, Py_ssize_t i1, Py_ssize_t i2);
// Return value: New reference.
// Return the slice of sequence object o between i1 and i2, or NULL on failure. This is the equivalent of the Python expression o[i1:i2].

unit_or_fail PySequence_SetItem(PySequenceObject *o, Py_ssize_t i, [stolen] PyObject *v); [mlname setItemPos]
// Assign object v to the ith element of o. Returns -1 on failure. This is the equivalent of the Python statement o[i] = v. This function does not steal a reference to v.

unit_or_fail PySequence_DelItem(PySequenceObject *o, Py_ssize_t i); [mlname delItemPos]
// Delete the ith element of object o. Returns -1 on failure. This is the equivalent of the Python statement del o[i].

unit_or_fail PySequence_SetSlice(PySequenceObject *o, Py_ssize_t i1, Py_ssize_t i2, PySequenceObject *v);
// Assign the sequence object v to the slice in sequence object o from i1 to i2. This is the equivalent of the Python statement o[i1:i2] = v.

unit_or_fail PySequence_DelSlice(PySequenceObject *o, Py_ssize_t i1, Py_ssize_t i2);
// Delete the slice in sequence object o from i1 to i2. Returns -1 on failure. This is the equivalent of the Python statement del o[i1:i2].

size_or_fail PySequence_Count(PySequenceObject *o, PyObject *value_);
// Return the number of occurrences of value in o, that is, return the number of keys for which o[key] == value. On failure, return -1. This is equivalent to the Python expression o.count(value).

bool_or_fail PySequence_Contains(PySequenceObject *o, PyObject *value_);
// Determine if o contains value. If an item in o is equal to value, return 1, otherwise return 0. On error, return -1. This is equivalent to the Python expression value in o.

size_or_fail PySequence_Index(PySequenceObject *o, PyObject *value_);
// Return the first index i for which o[i] == value. On error, return -1. This is equivalent to the Python expression o.index(value).

[new] PyListObject* PySequence_List(PySequenceObject *o);
// Return value: New reference.
// Return a list object with the same contents as the arbitrary sequence o. The returned list is guaranteed to be new.

[new] PyTupleObject* PySequence_Tuple(PySequenceObject *o);
// Return value: New reference.
// Return a tuple object with the same contents as the arbitrary sequence o or NULL on failure. If o is a tuple, a new reference will be returned, otherwise a tuple will be constructed with the appropriate contents. This is equivalent to the Python expression tuple(o).

[new] PyTupleObject* PySequence_Fast(PySequenceObject *o, [string] const char *m);
// Return value: New reference.
// Returns the sequence o as a tuple, unless it is already a tuple or list, in which case o is returned. Use PySequence_Fast_GET_ITEM() to access the members of the result. Returns NULL on failure. If the object is not a sequence, raises TypeError with m as the message text.

PyObject* PySequence_Fast_GET_ITEM(PySequenceObject *o, Py_ssize_t i);
// Return value: Borrowed reference.
// Return the ith element of o, assuming that o was returned by PySequence_Fast(), o is not NULL, and that i is within bounds.

// PyObject** PySequence_Fast_ITEMS(PySequenceObject *o);
// Return the underlying array of PyObject pointers. Assumes that o was returned by PySequence_Fast() and o is not NULL.
// Note, if a list gets resized, the reallocation may relocate the items array. So, only use the underlying array pointer in contexts where the sequence cannot change.

[new] PyObject* PySequence_ITEM(PySequenceObject *o, Py_ssize_t i);
// Return value: New reference.
//Return the ith element of o or NULL on failure. Macro form of PySequence_GetItem() but without checking that PySequence_Check(o)() is true and without adjustment for negative indices.

size_or_fail PySequence_Fast_GET_SIZE(PySequenceObject *o);
// Returns the length of o, assuming that o was returned by PySequence_Fast() and that o is not NULL. The size can also be gotten by calling PySequence_Size() on o, but PySequence_Fast_GET_SIZE() is faster because it can assume o is a list or tuple.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.