[Python-ideas] a sorting protocol dunder method?

Antoine Pitrou solipsis at pitrou.net
Mon Dec 4 07:56:31 EST 2017


On Mon, 4 Dec 2017 12:19:07 +0000
Paul Moore <p.f.moore at gmail.com> wrote:
> On 4 December 2017 at 11:41, Steven D'Aprano <steve at pearwood.info> wrote:
> > On Sun, Dec 03, 2017 at 10:48:18PM -0800, Carl Meyer wrote:  
> >> I think this is an interesting idea, and I don't believe that either
> >> performance or "sortable vs comparable" are very relevant.  
> >
> > Performance is always relevant -- while performance shouldn't be the
> > sole deciding factor, it should be a factor.
> >
> > And since the entire use-case for this is sorting versus comparison
> > operators, I'm having trouble understanding why you think that sorting
> > versus comparison operators is irrelevant.  
> 
> I'm not completely clear on what the expectation is (in terms of
> "sortable vs comparable") here.

It's quite clear if you read what Chris Barker posted originally (and
which I agree with).  We're talking about deriving comparison methods
from a key function *while* making sorting potentially faster, because
the costly reduction operation happens O(n) times instead of O(n log n)
times.

Steven OTOH seems to be inventing controversies just for the sake of
posting a rant.

Regards

Antoine.




More information about the Python-ideas mailing list