@@ -0,0 +1,898 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0Aimport functools%0A%0A%0Adef myfunc(a, b=2):%0A    %22%22%22Docstring for myfunc().%22%22%22%0A    print '%5Ctcalled myfunc with:', (a, b)%0A    return%0A%0A%0Adef show_details(name, f, is_partial=False):%0A    %22%22%22Show details of a callable object.%22%22%22%0A    print '%25s:' %25 name%0A    print '%5Ctobject:', f%0A    if not is_partial:%0A        print '%5Ct__name__:', f.__name__%0A    print '%5Ct__doc__', repr(f.__doc__)%0A    if is_partial:%0A        print '%5Ctfunc:', f.func%0A        print '%5Ctargs:', f.args%0A        print '%5Ctkeywords:', f.keywords%0A    return%0A%0A%0Ashow_details('myfunc', myfunc)%0Amyfunc('a', 3)%0Aprint%0A%0Ap1 = functools.partial(myfunc, b=4)%0Ashow_details('partial with named default', p1, True)%0Ap1('default a')%0Ap1('override b', b=5)%0Aprint%0A%0Ap2 = functools.partial(myfunc, 'default a', b=99)%0Ashow_details('partial with defaults', p2, True)%0Ap2()%0Ap2(b='override b')%0Aprint%0A%0Aprint 'Insufficient arguments:'%0Ap1()%0A

add functools_partial