Skip to content

Instantly share code, notes, and snippets.

@dutc
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dutc/41ccd140721613832a49 to your computer and use it in GitHub Desktop.
Save dutc/41ccd140721613832a49 to your computer and use it in GitHub Desktop.
simple module import time constraint
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