Bugs item #1602378, was opened at 2006-11-24 09:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1602378&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Daniel Eloff (eloff)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorrect docs for bisect_left
Initial Comment:
Quote:
Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e < x, and all e in a[i:]
have e >= x. So if x already appears in the list, i points just before the
leftmost x already there.
The last sentence is incorrect, and it contradicts what comes earlier. Not
knowing which is correct, I had to test it in the shell.
>>> from bisect import *
>>> l = [1,2,3,3,3,4,5]
>>> bisect_left(l,3)
2
>>> l[2:]
[3, 3, 3, 4, 5]
It should be changed to read "i points at the leftmost x already there"
-Dan
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1602378&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com