aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2011-09-22 09:21:15 +0200
committerArmin Rigo <arigo@tunes.org>2011-09-22 09:21:15 +0200
commit33bb5a86c0766434c50366015f3122a736268832 (patch)
tree0e97b234f3109644040bdfb1a0aab149a9900f0a /lib_pypy/_functools.py
parentMerged in unroll-if-alt: (diff)
downloadpypy-33bb5a86c0766434c50366015f3122a736268832.tar.gz
pypy-33bb5a86c0766434c50366015f3122a736268832.tar.bz2
pypy-33bb5a86c0766434c50366015f3122a736268832.zip
Tweak for the common case of no **keyword arguments.
Diffstat (limited to 'lib_pypy/_functools.py')
-rw-r--r--lib_pypy/_functools.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib_pypy/_functools.py b/lib_pypy/_functools.py
index 48e56d0ff0..39325a6b75 100644
--- a/lib_pypy/_functools.py
+++ b/lib_pypy/_functools.py
@@ -14,10 +14,9 @@ class partial(object):
raise TypeError("the first argument must be callable")
self.func = func
self.args = args
- self.keywords = keywords
+ self.keywords = keywords or None
def __call__(self, *fargs, **fkeywords):
- newkeywords = self.keywords.copy()
- newkeywords.update(fkeywords)
- return self.func(*(self.args + fargs), **newkeywords)
-
+ if self.keywords is not None:
+ fkeywords.update(self.keywords)
+ return self.func(*(self.args + fargs), **fkeywords)