The following test prints out “dcba”, which is what you would expect if you start with “d”, append “c” to it, append “b” to it, and then append “a” to it:

f = append_a * append_b * append_c
print f('d')

One use case for this is that to very elegantly and progressively add attributes to Django’s form widgets. Let’s say we want to add the HTML5, “required” attribute, and a “required” class to make sure jquery-validation works. We also want to add a “input-file” class to file fields, so that the Twitter Bootstrap renders them properly.

With the help of the add_class() function from my last entry, we make this work: