Skip to content

Instantly share code, notes, and snippets.

@t00n t00n/yolo.py
Created Mar 5, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.