bisect uses __cmp__()?

Gary Robinson grobinson at transpose.com
Wed Jul 30 10:08:27 EDT 2003


[Tim Peters]
> Well, it doesn't use __cmp__ directly now, and never has:  it uses Python's
> infix "<" operator.  While not documented, it's deliberate that bisect
> *only* uses "<", so that instances of a class implementing only __lt__ can
> use bisect.

OK, but why is it undocumented that bisect uses it, and that CPython's
list.sort() uses it? I still don't know if I can write code that is based
using __lt__ to define a sort order and be justified in assuming it will
work in the future.

I can't see much downside in making that behavior well-defined in the
docs...?

 
--Gary

-- 
Putting http://wecanstopspam.org in your email helps it pass through
overzealous spam filters.

Gary Robinson
CEO
Transpose, LLC
grobinson at transpose.com
207-942-3463
http://www.transpose.com
http://radio.weblogs.com/0101454







More information about the Python-list mailing list