On Wed, Jan 09, 2008 at 11:26:52AM -0800, Bill Janssen wrote:
> I'm a bit baffled here; I find cmp() fairly handy in writing sort
> routines:
> 
>    newlist = oldlist.sort(lambda v1, v2: cmp(v1.attr_x, v2.attr_x))
> 
> Is there a better / newer / official way of doing this?

   newlist = oldlist.sort(key=lambda v: v.attr_x)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to