documentation index ◦ reference manual ◦ function index
Function: | renpy.partial | (function, *args, **kwargs): |
When called with a function and optional arguments, this function returns a callable object. When that object is called, function is called with the arguments from both calls. Positional arguments from the first call are placed before positional arguments from the second call. If a keyword argument is given in both calls, the value from the second call takes priority.
The callable objects can be pickled provided the original function remains available at its original name.
init python: def add(a, b): return a + b python: add_to_one = renpy.partial(add, 1) result = add_to_one(2) # Result is now 3.