Skip to content

Instantly share code, notes, and snippets.

@tilalis
Created February 6, 2020 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tilalis/086fec902b3758554a53bca5108deef1 to your computer and use it in GitHub Desktop.
Save tilalis/086fec902b3758554a53bca5108deef1 to your computer and use it in GitHub Desktop.
WTFPython
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