[pypy-commit] pypy default: And while we're at it, attack methodcaller() too.
arigo
noreply at buildbot.pypy.org
Fri Jun 17 14:26:07 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r44987:73d001b38029
Date: 2011-06-17 14:29 +0200
http://bitbucket.org/pypy/pypy/changeset/73d001b38029/
Log: And while we're at it, attack methodcaller() too.
diff --git a/pypy/module/operator/app_operator.py b/pypy/module/operator/app_operator.py
--- a/pypy/module/operator/app_operator.py
+++ b/pypy/module/operator/app_operator.py
@@ -116,12 +116,7 @@
return builtinify(getter)
-class methodcaller(object):
-
- def __init__(self, method_name, *args, **kwargs):
- self.method_name = method_name
- self.args = args
- self.kwargs = kwargs
-
- def __call__(self, obj):
- return getattr(obj, self.method_name)(*self.args, **self.kwargs)
+def methodcaller(method_name, *args, **kwargs):
+ def call(obj):
+ return getattr(obj, method_name)(*args, **kwargs)
+ return builtinify(call)
More information about the pypy-commit
mailing list