Show More
Commit Description:
merge with algo and add brython files that were missing
Commit Description:
merge with algo and add brython files that were missing
References:
File last commit:
Show/Diff file:
Action:
lib/assets/Lib/_functools.py
| 21 lines
| 609 B
| text/x-python
| PythonLexer
|
r584 | def partial(func, *args, **keywords): | |||
def newfunc(*fargs, **fkeywords): | ||||
newkeywords = keywords.copy() | ||||
newkeywords.update(fkeywords) | ||||
return func(*(args + fargs), **newkeywords) | ||||
newfunc.func = func | ||||
newfunc.args = args | ||||
newfunc.keywords = keywords | ||||
return newfunc | ||||
def reduce(func,iterable,initializer=None): | ||||
args = iter(iterable) | ||||
if initializer is not None: | ||||
res = initializer | ||||
else: | ||||
res = next(args) | ||||
while True: | ||||
try: | ||||
res = func(res,next(args)) | ||||
except StopIteration: | ||||
return res | ||||