Skip to content

Instantly share code, notes, and snippets.

@eclecticmiraclecat
Created June 1, 2020 14:05
Show Gist options
  • Save eclecticmiraclecat/419290c7e9a946a0c12b94ada9ad440b to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/419290c7e9a946a0c12b94ada9ad440b to your computer and use it in GitHub Desktop.
>>> class mytype(type):
... def __new__(meta, clsname, bases, methods):
... print('Creating: ', clsname)
... return super().__new__(meta, clsname, bases, methods)
...
>>> class Spam(metaclass=mytype):
... def __init__(self, y):
... self.y = y
... def bar(self):
... print('bar')
...
Creating: Spam
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment