What does built-in class attribute __doc__ do in Python?

PythonServer Side ProgrammingProgramming

All functions have a built-in attribute __doc__, which returns the doc string defined in the function source code.

def foo():
    """ This is an example of how a doc_string looks like.
          This string gives useful information about the function being defined.
    """
    pass
print foo.__doc__

 Let's see how this would look like when we print it

This is an example of how a doc_string looks like.
          This string gives useful information about the function being defined.


raja
Published on 12-Jan-2018 14:13:07
Advertisements