This page is out of date

You've reached a page on the Ren'Py wiki. Due to massive spam, the wiki hasn't been updated in over 5 years, and much of the information here is very out of date. We've kept it because some of it is of historic interest, but all the information relevant to modern versions of Ren'Py has been moved elsewhere.

Some places to look are:

Please do not create new links to this page.


renpy.curry

Currying is an operation that allows a function to be called using a chain of calls, each providing some of the arguments. In Ren'Py, calling renpy.curry(func) returns a callable object. When this object is called with arguments, a second callable object is returned that stores func and the supplied arguments. When this second callable object is called, the original function is called with the stored arguments and the arguments supplied to the second call.

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.

Curry objects can be pickled provided the original function remains available at its original name.

init python:
     def real_add(a, b):
           return a + b

     add = renpy.curry(real_add)

label start:
     $ v = add(1)
     $ result = v(2)

     # result is now 3.