Last active
June 3, 2022 04:34
-
-
Save k0nserv/964647294224bb97755fcf5324732b9b to your computer and use it in GitHub Desktop.
It's British, innit?
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 British(type): | |
def __call__(cls, *args): | |
foo = cls.__new__(cls) | |
foo.__innit__(*args) | |
return foo |
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
from british import British | |
class Foo(metaclass=British): | |
def __init__(self): | |
print("Not here") | |
def __innit__(self): | |
self.x = 10 | |
if __name__ == "__main__": | |
a = Foo() | |
print(a.x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment