Could we consider sorted as an high order function?

sorted_list = sorted(list_strings, key = str.lower)

2011/2/14 Steven D'Aprano <st...@pearwood.info>

> Steven D'Aprano wrote:
>
>  An example might help. Back in the old days, before Python had a sum()
>> function, the easiest way to add up a list of numbers was to use reduce and
>> a small function to add two numbers:
>>
>> def add(x, y):
>>    return x+y
>>
>> total = filter(add, [2, 4, 5, 9, 1])
>>
>
> Arggggh! Of course, I meant *reduce* in that example, not filter. Sorry for
> any confusion!
>
>
>
>
> --
> Steven
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to