def copy_doc(source):
 def wrapper(func):
  if ((source.__doc__ is None) or (len(source.__doc__) == 0)):
   raise ValueError('Cannot copy docstring: docstring was empty.')
  doc = source.__doc__
  if (func.__doc__ is not None):
   doc += func.__doc__
  func.__doc__ = doc
  return func
 return wrapper

def copy_doc ( source ) : def wrapper ( func ) : if ( ( source . __doc__ is None ) or ( len ( source . __doc__ ) == 0 ) ) : raise ValueError ( 'Cannot copy docstring: docstring was empty.' ) doc = source . __doc__ if ( func . __doc__ is not None ) : doc += func . __doc__ func . __doc__ = doc return func return wrapper
decorator to copy the docstring from another function .