[root@localhostpython]# cat foo.py
#!/usr/bin/env python
"""foo.py--sample module demonstrating documentation strings"""
class Foo(object):
"""Foo() -empty class ... to bedeveloped"""
def bar(x):
"""bar(x) -function docstring for bar,prints outits arg 'x'"""
print x
[root@localhostpython]# python
Python 2.7.9 (default,Feb 18 2016, 11:31:36)
[GCC 4.4.7 20120313(Red Hat 4.4.7-16)] on linux2
Type "help","copyright", "credits" or "license" for moreinformation.
>>> import foo
>>>foo.__doc__
'foo.py --sample moduledemonstrating documentation strings'
>>>foo.Foo.__doc__
'Foo() -empty class ...to be developed'
>>>foo.bar.__doc__
"bar(x) -functiondocstring for bar,prints out its arg 'x'"