A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-August/091208.html below:

[Python-Dev] functools.compose to chain functions together

[Python-Dev] functools.compose to chain functions together [Python-Dev] functools.compose to chain functions togetherAntoine Pitrou solipsis at pitrou.net
Mon Aug 17 12:59:40 CEST 2009
Le lundi 17 août 2009 à 09:07 +0200, "Martin v. Löwis" a écrit :
> Ok, that's also what the patch has proposed. I was puzzled when I read
> 
>    l.sort(key=compose(itemgetter(1), itemgetter(0))))
> 
> because I expected it to mean
> 
>    l.sort(key=lambda x:x[1][0])

But that's itemgetter's fault, not compose's. Because itemgetter's
obvious equivalent (the [] operator) uses postfix notation, combining
several itemgetters reverses the lexical order of appearance.

Besides, the argument order is similar to the one in the function
composition notation in mathematics (which isn't really advanced stuff
and should have been taught to every former scientific/technical student
out there).

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4