def inherits_docstring(f, cls=None, funcname=None):
    """A decorator for inheriting function docstrings.

    If f is a class, return a decorator that looks to the class for
    the docstring to inherit.

    """
    if isinstance(f, type):
        #passed a class, so return a decorator
        cls = f
        def decorator(func):
            return inherits_docstring(func, cls)
        return decorator

    # otherwise used as decorator
    if cls is None:
        # don't know how to do this without a metaclass
        raise NotImplementedError
    return inherits_docstring_func(f, cls, funcname)
A decorator for inheriting function docstrings.

    If f is a class, return a decorator that looks to the class for
    the docstring to inherit.

    
recipes/Python/577743_Using_Metaclasses_Class_Decorators_Inherit/recipe-577743.py