Last active
August 29, 2015 14:04
-
-
Save dutc/41ccd140721613832a49 to your computer and use it in GitHub Desktop.
simple module import time constraint
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 BaseMeta(type): | |
def __new__(cls, name, bases, dict): | |
if 'foo' not in dict: | |
raise RuntimeError('class must have its own foo method!') | |
return type.__new__(cls, name, bases, dict) | |
class Base(metaclass=BaseMeta): | |
def foo(self): pass | |
class Derived(Base): | |
def foo(self): pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment