On Mon, Mar 24, 2014 at 11:36 PM, Marko Rauhamaa <ma...@pacujo.net> wrote: >> def get_oneth_element_index(item): >> return item[1].index >> L.sort(key=get_oneth_element_index) >> >> Or do you just shortcut the whole thing by inlining it? >> >> L.sort(key=lambda item:item[1].index) > > I still prefer the "def" variant. It even allows you to clarify the > meaning of the tuple slot by using a nicer name.
It's the index of element 1. What more do you need to know? Is it actually any help to give that a name? All you gain is a chance for the name, the purpose, and the functionality to come into disagreement. ChrisA -- https://mail.python.org/mailman/listinfo/python-list