[Python-3000] Total ordering and cmp (original) (raw)

Steven Bethard steven.bethard at gmail.com
Wed Mar 21 21:24:25 CET 2007


On 3/21/07, Adam Olsen <rhamph at gmail.com> wrote:

On 3/20/07, Steven Bethard <steven.bethard at gmail.com> wrote: > I've used a key() method quite successfully in my own code. Maybe > we should provide a mixin like:: > > class KeyedComparisonMixin(object): > def eq(self, other): > return self.key() == other.key() [snip] This seems to match what I've usually needed, but I'm not sure it's worth putting in python proper. How about a cookbook entry? It would also be nice to reference in a guide on making code 3.0-ready.

Done.

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/510403

STeVe

I'm not in-sane. Indeed, I am so far out of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy



More information about the Python-3000 mailing list