Skip to content

Instantly share code, notes, and snippets.

@jdswinbank
Created June 7, 2013 08:17
Show Gist options
  • Save jdswinbank/5727783 to your computer and use it in GitHub Desktop.
Save jdswinbank/5727783 to your computer and use it in GitHub Desktop.
def factory_function():
default_par = "something"
default_foo = "something else"
def returned_function(x, par=default_par, foo=default_foo):
print "x is " + str(x)
print "par is " + str(par)
print "foo is " + str(foo)
return returned_function
fn = factory_function()
fn("x")
fn("x", "y", "z")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment