On Wed, Jan 09, 2008 at 11:34:59AM -0800, Brett Cannon wrote: > On Jan 9, 2008 11:34 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > newlist = oldlist.sort(key=lambda v: v.attr_x) > > And don't forget about operator.attrgetter().
I don't like it for the task. To use I need to import operator, and I don't know is it faster or slower than lambda; I suspect it's slower but I am too lazy to test. Using lambda to get a simple attribute seems much simpler to me. 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