Issue 1506171: Add "methodcaller" to the operator module (original) (raw)

Created on 2006-06-14 16:02 by gregory_p, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
methodcaller.diff georg.brandl,2008-01-20 15:16 methodcaller patch
Messages (5)
msg54822 - (view) Author: Gregory Petrosyan (gregory_p) Date: 2006-06-14 16:02
I found that I (like Alex Martelli, http://mail.python. org/pipermail/python-dev/2006-February/060341.html :-) am writing lambdas like "lambda x: x.do_smth(a,b,c)" a lot (often for filter/map functions). So, I think it would be great to have such a function implemented in C and placed in the standart library. Operator module can be a good place for it. -- Regards, Gregory.
msg54823 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-30 14:39
Guido has stated that lambda will not be removed in Python 3000 (see PEP 3099), so I can't see the need for a HOF to avoid lambda-usage, especially when the lambda expression is shorter/clearer: operator.methodcaller('method', x, y, z) lambda x: x.method(x, y, z)
msg54824 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2007-03-30 16:46
Re-opening. There are valid use cases for this request and there are some speed benefits to having a functional form.
msg61305 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-20 15:16
Attaching patch against SVN trunk.
msg62835 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-02-23 23:05
Committed patch as r61028.
History
Date User Action Args
2022-04-11 14:56:18 admin set github: 43497
2008-02-23 23:05:10 georg.brandl set status: open -> closedassignee: rhettinger -> georg.brandlresolution: acceptedmessages: +
2008-01-20 15:16:15 georg.brandl set files: + methodcaller.diffassignee: rhettingerresolution: rejected -> (no value)messages: + nosy: + georg.brandl
2006-06-14 16:02:40 gregory_p create