In <[EMAIL PROTECTED]>, mosscliffe
wrote:

> I have tried the following, for a one dimensional list and it works,
> but I can not get my head around this lambda. How would this be
> written, without the lamda ?

Well ``lambda``\s are just anonymous functions so you can write it with a
named function of course.

> mylist = ['Fred','bill','PAUL','albert']
> 
> mylist.sort(key=lambda el: el.lower())

So this becomes:

def keyfunc(el):
    return el.lower()

mylist.sort(key=keyfunc)

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to