Created
February 6, 2020 12:37
-
-
Save tilalis/086fec902b3758554a53bca5108deef1 to your computer and use it in GitHub Desktop.
WTFPython
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 Provider: | |
def __init__(self, name): | |
self.name = name | |
def __getattr__(self, attr): | |
return Provider(self.name + '.' + str(attr)) | |
def __rmatmul__(self, other): | |
return other + '@' + self.name | |
gmail = Proviier("gmail") | |
mail = Provider("mail") | |
yandex = Provider("yandex") | |
if __name__ == "__main__": | |
print("bob"@gmail.com) | |
print("alice"@mail.ru) | |
print("carol"@yandex.by) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment