This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abacabadabacaba
Recipients abacabadabacaba, rhettinger
Date 2015-10-25.16:55:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1445792142.26.0.767319041021.issue25454@psf.upfronthosting.co.za>
In-reply-to
Content
There are methods that accept a single argument and behave like a binary operation or a predicate. It would be useful to be able to turn them into binary functions for use with higher-order functions like map and reduce:

    reduce(methodcaller("combine"), objs) # reduce a sequence using "combine" method
    map(methodcaller("combine"), alist, blist) # combine pairs of elements
    all(map(methodcaller("compatible_with"), alist, blist)) # check that pairs of elements are compatible

This functionality is already available for overloaded operators, because operator module provides them as functions. Some methods behave similarly to operators, so I think that a similar functionality should be available for them as well.
History
Date User Action Args
2015-10-25 16:55:42abacabadabacabasetrecipients: + abacabadabacaba, rhettinger
2015-10-25 16:55:42abacabadabacabasetmessageid: <1445792142.26.0.767319041021.issue25454@psf.upfronthosting.co.za>
2015-10-25 16:55:42abacabadabacabalinkissue25454 messages
2015-10-25 16:55:41abacabadabacabacreate