diff options
author | Michael W. Hudson <mwh@python.net> | 2002-06-11 10:55:12 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2002-06-11 10:55:12 (GMT) |
commit | 5efaf7eac8c1dbbf82a96dc5d9b87fddd5d17b58 (patch) | |
tree | 7358a0479ab98893ad5a5457ae0df328d0e60251 /Doc/api | |
parent | f90ae20354ceb501f0ba0b6459df17f1a8005a47 (diff) | |
download | cpython-5efaf7eac8c1dbbf82a96dc5d9b87fddd5d17b58.zip cpython-5efaf7eac8c1dbbf82a96dc5d9b87fddd5d17b58.tar.gz cpython-5efaf7eac8c1dbbf82a96dc5d9b87fddd5d17b58.tar.bz2 |
This is my nearly two year old patch
[ 400998 ] experimental support for extended slicing on lists
somewhat spruced up and better tested than it was when I wrote it.
Includes docs & tests. The whatsnew section needs expanding, and arrays
should support extended slices -- later.
Diffstat (limited to 'Doc/api')
-rw-r--r-- | Doc/api/concrete.tex | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Doc/api/concrete.tex b/Doc/api/concrete.tex index 8316b2d..2face20 100644 --- a/Doc/api/concrete.tex +++ b/Doc/api/concrete.tex @@ -2288,6 +2288,32 @@ They are found in the dictionary of type objects. \begin{cfuncdesc}{int}{PySlice_GetIndices}{PySliceObject *slice, int length, int *start, int *stop, int *step} +Retrieve the start, stop and step indices from the slice object +\var{slice}, assuming a sequence of length \var{length}. Treats +indices greater than \var{length} as errors. + +Returns 0 on success and -1 on error with no exception set (unless one +of the indices was not \constant{None} and failed to be converted to +an integer, 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 in versions of Python prior to 2.3, you would probably +do well to incorporate the source of \cfunction{PySlice_GetIndicesEx}, +suitably renamed, in the source of your extension. +\end{cfuncdesc} + +\begin{cfuncdesc}{int}{PySlice_GetIndicesEx}{PySliceObject *slice, int length, + int *start, int *stop, int *step, + int *slicelength} +Usable replacement for \cfunction{PySlice_GetIndices}. Retrieve the +start, stop, and step indices from the slice object \var{slice} +assuming a sequence of length \var{length}, and store the length of +the slice in \var{slicelength}. Out 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. + +\versionadded{2.3} \end{cfuncdesc} |