Skip to content

Instantly share code, notes, and snippets.

@k0nserv
Last active June 3, 2022 04:34
Show Gist options
  • Save k0nserv/964647294224bb97755fcf5324732b9b to your computer and use it in GitHub Desktop.
Save k0nserv/964647294224bb97755fcf5324732b9b to your computer and use it in GitHub Desktop.
It's British, innit?
class British(type):
def __call__(cls, *args):
foo = cls.__new__(cls)
foo.__innit__(*args)
return foo
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