[code.view]

[top] / python / PyMOTW / doctest / doctest_simple_with_docs.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Simple example using doctest
     """
     #end_pymotw_header
     
     def my_function(a, b):
         """Returns a * b.
     
         Works with numbers:
         
         >>> my_function(2, 3)
         6
     
         and strings:
         
         >>> my_function('a', 3)
         'aaa'
         """
         return a * b
         
     
     
     

[top] / python / PyMOTW / doctest / doctest_simple_with_docs.py

contact | logmethods.com