
Oct. 14, 2011
7:08 a.m.
Nick Coghlan wrote:
On Fri, Oct 14, 2011 at 11:10 AM, Ron Adam <ron3200@gmail.com> wrote:
def sorted_with(key): def _(seq): return sorted(seq, key=key) return _
@sorted_with def key_sorted(item): return item.attr1, item.attr2
Seriously? You're suggesting that mess of symbols and indentation as a good answer to the programming task "I want to sort the items in this sequence according to the values of attr1 and attr2"?
I don't think that example is as well-constructed as it could be. The key_sorted function would be better named something like 'sort_by_attr1_and_attr2'. -- Greg