Last active
April 14, 2019 16:08
-
-
Save flowpoint/f094484804052b37a9048c33adcc05ad to your computer and use it in GitHub Desktop.
python wrapper class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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