On Sun, 27 Jun 2010 00:59:35 +0200, Laurent Verweijen wrote: > Something I really dislike, is that the "__cmp__"-method is gone. I > really hate to write 6 different functions, whereas I'm used to writing > a oneliners which covers each of the 6 cases. I haven't switched to > pyton 3 yet, but when I do, I will give my classes a single compare > method and omit the syntactic sugar.
Thanks to Raymond Hettinger, Python 2.7 and 3.2 now contain decorators to simplify the writing of rich comparisons. See this recipe for details: http://code.activestate.com/recipes/576685/ If you want more than that, there's Michael Foord's recipe: http://code.activestate.com/recipes/576529/ -- Steven -- http://mail.python.org/mailman/listinfo/python-list