[Tutor] Higher-Order Function Examples

Rafael Durán Castañeda rafadurancastaneda at gmail.com
Mon Feb 14 21:23:54 CET 2011


In the example I gave:

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

sorted takes str.lower as a parameter, doesn't it? So, it should be a high
order function

El 14 de febrero de 2011 21:06, Walter Prins <wprins at gmail.com> escribió:

>
>
> 2011/2/14 Rafael Durán Castañeda <rafadurancastaneda at gmail.com>
>
> Could we consider sorted as an high order function?
>>
>> sorted_list = sorted(list_strings, key = str.lower)
>>
>>
> No because sorted() returns a list as a result.   A higher order function
> produces another function as a result, or takes one or more functions as a
> parameter.
>
> Walter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110214/cf8b2ffb/attachment.html>


More information about the Tutor mailing list