class DocMeta(type): def __init__(self, name, bases, attrs): for key, value in attrs.items(): # skip special/private methods if key.startswith("__"): continue # skip any non-callable if not hasattr(value, "__call__"): continue # check for a doc string. if not getattr(value, '__doc__'): raise TypeError("%s must have a docstring" % key) type.__init__(self, name, bases, attrs)