pypy / lib_pypy /

The branch 'jvm-improvements' does not exist.
Full commit
Daniel Roberts 0077cf5 

Benjamin Peterso… 836e7a0 

Amaury Forgeot d… c837c75 
Daniel Roberts 0077cf5 

Armin Rigo 655453f 
Daniel Roberts 0077cf5 

Armin Rigo 655453f 
Alex Gaynor f098880 
Armin Rigo 655453f 
""" Supplies the internal functions for in the standard library """

# reduce() has moved to _functools in Python 2.6+.
reduce = reduce

class partial(object):
    partial(func, *args, **keywords) - new function with partial application
    of the given arguments and keywords.

    def __init__(self, func, *args, **keywords):
        if not callable(func):
            raise TypeError("the first argument must be callable")
        self.func = func
        self.args = args
        self.keywords = keywords or None

    def __call__(self, *fargs, **fkeywords):
        if self.keywords is not None:
            fkeywords = dict(self.keywords, **fkeywords)
        return self.func(*(self.args + fargs), **fkeywords)