Created
September 7, 2016 23:55
-
-
Save doctaphred/bb74064bb65cb1e9dd04875919f7c018 to your computer and use it in GitHub Desktop.
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
| magic = lambda x: x() | |
| class word: | |
| def __init__(self, current, prev=None): | |
| self.current = current | |
| self.prev = prev | |
| def __getattr__(self, name): | |
| return self.__class__(name, self) | |
| def __repr__(self): | |
| if self.prev is None: | |
| return self.current | |
| else: | |
| return repr(self.prev) + ' ' + self.current | |
| @magic | |
| class say: | |
| def __getattr__(self, name): | |
| return word(name) | |
| say.hello.world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment