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.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to