Neil Cerutti wrote:

>> bisect...
> 
> That doesn't tell me if an item doesn't exist in the sequence
> though, does it?  Maybe I'm being dense.

I guess you could use something like

import bisect

def check(list, item):
     try:
        return list[bisect.bisect_left(list, item)] == item
     except IndexError:
        return False

but unless your lists are really large, or your objects are expensive to 
compare, you could probably just use "in" instead.

 > My guess nobody keeps their sequences sorted in Python.

well, people tend to use dictionaries when they need to look things up 
quickly...

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to