Python 2.x breaks cmp() (was Re: A suspected bug)

Scottie me at nospam.net
Sat Feb 24 20:27:16 CET 2001


"Tim Peters" <tim.one at home.com> wrote in message
news:mailman.982706124.20851.python-list at python.org...
> .... I think I'm going to be more bothered by tuple comparisons.
> For example, I often use bisect.insort() to maintain short lists of tuples
> of the form
>     (priority_integer, some_object)
> or
>     (first_time_to_deal_with_it, some_object)
> ordered by the first element.  If there's ever a tie on the first element,
> the builtin lexicographic comparison goes on to compare the second ...

I am trying to put together a nice priority queue package.
With the new ops, I feel I should standardize my code to use a single
test, rather than willy-nilly use < and <= in various places.
What opinions do others have on whether I should use "<" or "<="?
I realize exceptions may get thrown or strange orders result from
using non-total-ordering relations (I view as a user problem).

So here's my question:
I'm building these priority queues on either < (>) or <= (>=).  If you
were to build only one of these two on a type which would it be?
Which of the two would you expect to be used in such a package?
How should I make this choice?


and-what-is-the-meaning-of-life-ly yours,
-Scott David Daniels
Scott.Daniels at Acm.Org






More information about the Python-list mailing list