On Jan 9, 2008 11:34 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > 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)
And don't forget about operator.attrgetter(). -Brett _______________________________________________ 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