# Last Change: Mon Aug 20 01:00 PM 2007 J
# Implement partial application (should only be used if functools is not
# available (eg python < 2.5)

class partial:
    def __init__(self, fun, *args, **kwargs):
        self.fun = fun
        self.pending = args[:]
        self.kwargs = kwargs.copy()

    def __call__(self, *args, **kwargs):
        if kwargs and self.kwargs:
            kw = self.kwargs.copy()
            kw.update(kwargs)
        else:
            kw = kwargs or self.kwargs

        return self.fun(*(self.pending + args), **kw)

Add partial evaluation tool to replace functools module for python < 2.5
Add partial evaluation tool to replace functools module for python < 2.5

From: cdavid <cdavid@cb17146a-f446-4be1-a4f7-bd7c5bb65646>

git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@236 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
