Created
June 1, 2020 14:05
-
-
Save eclecticmiraclecat/419290c7e9a946a0c12b94ada9ad440b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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