On May 15, 12:06 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> According
> to my ad hoc test you need <, <=, and == for nlargest()/nsmallest() to
> work:
In Py2.6 and after, you only need < and ==. I replaced the LE tests
with LT to match list.sort() and bisect.bisect(). The == arises
because nla
On May 15, 3:06 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > I spent several hours debugging some bogus data results that turned
> > out to be caused by the fact that heapq.nlargest doesn't respect rich
> > comparisons:
>
> > import heapq
> > import random
>
> >
George Sakkis wrote:
> I spent several hours debugging some bogus data results that turned
> out to be caused by the fact that heapq.nlargest doesn't respect rich
> comparisons:
>
> import heapq
> import random
>
> class X(object):
> def __init__(self, x): self.x=x
>
En Wed, 14 May 2008 23:47:56 -0300, George Sakkis <[EMAIL PROTECTED]> escribió:
> I spent several hours debugging some bogus data results that turned
> out to be caused by the fact that heapq.nlargest doesn't respect rich
> comparisons:
>
> import heapq
> import random
>
> class X(obje