docstrings in python .. how to use it ?

Home Forums Python Programming docstrings in python .. how to use it ?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #2083 Reply
    Humble
    Keymaster

    Simple concept ? yes, but useful..

    Docstring can be represented with the help of date between

    """ . 
    
    if you have a module called test , inside test.py you may have something like below:
    
    
    """
     I am test modules's docstring.
    
    """
    
    
    
    
    similary class , class methods and functions can have docstrings written ..
    
    class A:
        """ Class's docstring"""
        def A_method(self):
            """ A_methods docstring"""
    
    
    
    
    
    
    The docstring can be printed by help() or .__doc__
    
    
    >>>import test
    >>> test.__doc__
    " I am test modules's docstring"
    >>> help(test)
    Help on module test:
    
    NAME
        test - I am test modules's docstring
    
    FILE
        /home/hchiramm/Downloads/sql-back/test.py
    
    
    
    
    Let me know if you have any doubts..
Viewing 1 post (of 1 total)
Reply To: docstrings in python .. how to use it ?
Your information: