[Python-ideas] partial with skipped arguments

Calvin Spealman ironfroggy at gmail.com
Sun Apr 22 06:14:59 CEST 2007


I often wish you could bind to arguments in a partial out of order,
skipping some positionals. The solution I came up with is a singleton
object located as an attribute of the partial function itself and used
like this:

def foo(a, b):
    return a / b
pf = partial(foo, partial.skip, 2)
assert pf(1.0) == 0.5

-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/



More information about the Python-ideas mailing list