Skip to content

Instantly share code, notes, and snippets.

@alesegdia
Created June 11, 2015 10:55
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 alesegdia/6272e1ff559c5ec3a37b to your computer and use it in GitHub Desktop.
Save alesegdia/6272e1ff559c5ec3a37b to your computer and use it in GitHub Desktop.
python: functions i.
def upload_to_rename(instance, filename):
# handle instance and filename
return "sample"
def build_concat(basepath, f):
def _ret(instance, filename):
return basepath + f(instance, filename)
return _ret
foo = build_concat("some/base/path/", upload_to_rename)
foo(None, None) # returns 'some/base/path/sample'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment