diff options
author | Georg Brandl <georg@python.org> | 2009-04-05 22:20:44 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-05 22:20:44 +0000 |
commit | 27603fcebaeafa3469a2dccea9552a905c69bfb5 (patch) | |
tree | fb2aeb2b23af2c417267eb23062f4d7deb32ef2d /Doc/library/bisect.rst | |
parent | d874cc0a01e136d02c939e252761fdc743d00965 (diff) | |
download | cpython-27603fcebaeafa3469a2dccea9552a905c69bfb5.tar.gz |
Update signature style of optional arguments, part two.
Diffstat (limited to 'Doc/library/bisect.rst')
-rw-r--r-- | Doc/library/bisect.rst | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/Doc/library/bisect.rst b/Doc/library/bisect.rst index 9e77699e73..61b470baa4 100644 --- a/Doc/library/bisect.rst +++ b/Doc/library/bisect.rst @@ -1,4 +1,3 @@ - :mod:`bisect` --- Array bisection algorithm =========================================== @@ -17,43 +16,35 @@ example of the algorithm (the boundary conditions are already right!). The following functions are provided: -.. function:: bisect_left(list, item[, lo[, hi]]) - - Locate the proper insertion point for *item* in *list* to maintain sorted order. - The parameters *lo* and *hi* may be used to specify a subset of the list which - should be considered; by default the entire list is used. If *item* is already - present in *list*, the insertion point will be before (to the left of) any - existing entries. The return value is suitable for use as the first parameter - to ``list.insert()``. This assumes that *list* is already sorted. - - -.. function:: bisect_right(list, item[, lo[, hi]]) - - Similar to :func:`bisect_left`, but returns an insertion point which comes after - (to the right of) any existing entries of *item* in *list*. - - -.. function:: bisect(...) +.. function:: bisect_left(a, x, lo=0, hi=len(a)) - Alias for :func:`bisect_right`. + Locate the proper insertion point for *x* in *a* to maintain sorted order. + The parameters *lo* and *hi* may be used to specify a subset of the list + which should be considered; by default the entire list is used. If *x* is + already present in *a*, the insertion point will be before (to the left of) + any existing entries. The return value is suitable for use as the first + parameter to ``list.insert()``. This assumes that *a* is already sorted. -.. function:: insort_left(list, item[, lo[, hi]]) +.. function:: bisect_right(a, x, lo=0, hi=len(a)) + bisect(a, x, lo=0, hi=len(a)) - Insert *item* in *list* in sorted order. This is equivalent to - ``list.insert(bisect.bisect_left(list, item, lo, hi), item)``. This assumes - that *list* is already sorted. + Similar to :func:`bisect_left`, but returns an insertion point which comes + after (to the right of) any existing entries of *x* in *a*. -.. function:: insort_right(list, item[, lo[, hi]]) +.. function:: insort_left(a, x, lo=0, hi=len(a)) - Similar to :func:`insort_left`, but inserting *item* in *list* after any - existing entries of *item*. + Insert *x* in *a* in sorted order. This is equivalent to + ``a.insert(bisect.bisect_left(a, x, lo, hi), x)``. This assumes that *a* is + already sorted. -.. function:: insort(...) +.. function:: insort_right(a, x, lo=0, hi=len(a)) + insort(a, x, lo=0, hi=len(a)) - Alias for :func:`insort_right`. + Similar to :func:`insort_left`, but inserting *x* in *a* after any existing + entries of *x*. Examples |