Reformat prior to editing.

parent 089c5cdd
...@@ -22,34 +22,35 @@ Slice Objects ...@@ -22,34 +22,35 @@ Slice Objects
.. cfunction:: PyObject* PySlice_New(PyObject *start, PyObject *stop, PyObject *step) .. cfunction:: PyObject* PySlice_New(PyObject *start, PyObject *stop, PyObject *step)
Return a new slice object with the given values. The *start*, *stop*, and Return a new slice object with the given values. The *start*, *stop*, and
*step* parameters are used as the values of the slice object attributes of the *step* parameters are used as the values of the slice object attributes of
same names. Any of the values may be *NULL*, in which case the ``None`` will be the same names. Any of the values may be *NULL*, in which case the
used for the corresponding attribute. Return *NULL* if the new object could not ``None`` will be used for the corresponding attribute. Return *NULL* if
be allocated. the new object could not be allocated.
.. cfunction:: int PySlice_GetIndices(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) .. cfunction:: int PySlice_GetIndices(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step)
Retrieve the start, stop and step indices from the slice object *slice*, Retrieve the start, stop and step indices from the slice object *slice*,
assuming a sequence of length *length*. Treats indices greater than *length* as assuming a sequence of length *length*. Treats indices greater than
errors. *length* as errors.
Returns 0 on success and -1 on error with no exception set (unless one of the Returns 0 on success and -1 on error with no exception set (unless one of
indices was not :const:`None` and failed to be converted to an integer, in which the indices was not :const:`None` and failed to be converted to an integer,
case -1 is returned with an exception set). in which case -1 is returned with an exception set).
You probably do not want to use this function. If you want to use slice objects You probably do not want to use this function. If you want to use slice
in versions of Python prior to 2.3, you would probably do well to incorporate objects in versions of Python prior to 2.3, you would probably do well to
the source of :cfunc:`PySlice_GetIndicesEx`, suitably renamed, in the source of incorporate the source of :cfunc:`PySlice_GetIndicesEx`, suitably renamed,
your extension. in the source of your extension.
.. cfunction:: int PySlice_GetIndicesEx(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength) .. cfunction:: int PySlice_GetIndicesEx(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength)
Usable replacement for :cfunc:`PySlice_GetIndices`. Retrieve the start, stop, Usable replacement for :cfunc:`PySlice_GetIndices`. Retrieve the start,
and step indices from the slice object *slice* assuming a sequence of length stop, and step indices from the slice object *slice* assuming a sequence of
*length*, and store the length of the slice in *slicelength*. Out of bounds length *length*, and store the length of the slice in *slicelength*. Out
indices are clipped in a manner consistent with the handling of normal slices. of bounds indices are clipped in a manner consistent with the handling of
normal slices.
Returns 0 on success and -1 on error with exception set. Returns 0 on success and -1 on error with exception set.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment