def inherit_docstring_from(cls):
 def _doc(func):
  cls_docstring = getattr(cls, func.__name__).__doc__
  func_docstring = func.__doc__
  if (func_docstring is None):
   func.__doc__ = cls_docstring
  else:
   new_docstring = (func_docstring % dict(super=cls_docstring))
   func.__doc__ = new_docstring
  return func
 return _doc

def inherit_docstring_from ( cls ) : def _doc ( func ) : cls_docstring = getattr ( cls , func . __name__ ) . __doc__ func_docstring = func . __doc__ if ( func_docstring is None ) : func . __doc__ = cls_docstring else : new_docstring = ( func_docstring % dict ( super = cls_docstring ) ) func . __doc__ = new_docstring return func return _doc
this decorator modifies the decorated functions docstring by replacing occurrences of %s with the docstring of the method of the same name from the class cls .