Skip to content

Instantly share code, notes, and snippets.

@flowpoint
Last active April 14, 2019 16:08
Show Gist options
  • Save flowpoint/f094484804052b37a9048c33adcc05ad to your computer and use it in GitHub Desktop.
Save flowpoint/f094484804052b37a9048c33adcc05ad to your computer and use it in GitHub Desktop.
python wrapper class
class wrapper_class:
def __init__(self, val, *args, **kwargs):
if callable(val):
self.val = val(*args,**kwargs)
else:
self.val = val
def __getattr__(self,*args, **kwargs):
return self.val.__getattribute__(*args, **kwargs)
def __call__(self, *args, **kwargs):
return self.val.__call__(*args, **kwargs)
def __str__(self):
return str(self.val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment