[Python-bugs-list] [ python-Bugs-408798 ] 5.5 bisect documentation

noreply@sourceforge.net noreply@sourceforge.net
Thu, 15 Mar 2001 22:46:02 -0800


Bugs item #408798, was updated on 2001-03-15 07:10
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=408798&group_id=5470

Category: Documentation
Group: None
Status: Open
Priority: 5
Submitted By: Greg Kochanski (gpk)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: 5.5 bisect documentation

Initial Comment:
The documentation should note that if
item compares equal to list[i], it will
return i+1.  More generally, it returns
the index of the first element that compares
greater than item, or len(list) if item is larger
than everything in list.
This means that insort() sorts with minimal
rearrangement: if two items compare equal,
they will be on the list in the order with which
they were added.   This can be relevant for
classes which define a __cmp__() method.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-03-15 22:46

Message:
Logged In: YES 
user_id=31435

Note that the 2.1 docs already say this -- you can close 
this, Fred.

Greg, 2.1 also adds bisect_left and insort_left functions 
to bisect, in case you want the insertion point to be "to 
the left" of any pre-existing equal items instead.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=408798&group_id=5470