Created
June 10, 2021 13:55
-
-
Save youtux/ad398ea628bb1fd83e9aee66a868342e to your computer and use it in GitHub Desktop.
Python quick n dirty object wrapper
This file contains hidden or 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(object): | |
| def __init__(self, wrappee): | |
| self.wrappee = wrappee | |
| # Override your method here | |
| def foo(self): | |
| print('override foo') | |
| def __getattr__(self, attr): | |
| return getattr(self.wrappee, attr) | |
| class Wrappee(object): | |
| def foo(self): | |
| print('foo') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment