Skip to content

Instantly share code, notes, and snippets.

@ruliana
Last active October 11, 2021 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruliana/cfabf066a429c40c3e963813aabaa173 to your computer and use it in GitHub Desktop.
Save ruliana/cfabf066a429c40c3e963813aabaa173 to your computer and use it in GitHub Desktop.
Functional design patterns - builder function (Python)
def builder(builder_param, other_builder_param):
# ... optionally some initialization code
def the_actual_function(trivial_param):
# ... do stuff
return something
return the_actual_function
# Then later...
my_func = builder(x, y)
my_func(z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment