Skip to content

Instantly share code, notes, and snippets.

@t00n
Created March 5, 2018 20: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 t00n/de82a27692e12ba3286bfc510c02ba9e to your computer and use it in GitHub Desktop.
Save t00n/de82a27692e12ba3286bfc510c02ba9e to your computer and use it in GitHub Desktop.
Small module to add the curry() decorator from pymonad on every function of every subsequent import
import builtins
from inspect import getmembers, isfunction
from pymonad import curry
old_imp = builtins.__import__
def currify(mod):
for name, val in getmembers(mod):
if isfunction(val):
setattr(mod, name, curry(val))
def custom_import(*args, **kwargs):
module = old_imp(*args, **kwargs)
currify(module)
return module
builtins.__import__ = custom_import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment