Author: Alex Gaynor <alex.gay...@gmail.com> Branch: Changeset: r73558:c7fcbd1bcedd Date: 2014-09-16 11:32 -0700 http://bitbucket.org/pypy/pypy/changeset/c7fcbd1bcedd/
Log: Issue #1867 -- fixed performance and memory issues with operator.methodcaller 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 @@ -120,7 +120,11 @@ return builtinify(getter) -def methodcaller(method_name, *args, **kwargs): - def call(obj): - return getattr(obj, method_name)(*args, **kwargs) - return builtinify(call) +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) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit