[code.view]

[top] / python / PyMOTW / doctest / doctest_in_help.rst

     ===============================
      How to Use doctest_in_help.py
     ===============================
     
     This library is very simple, since it only has one function called
     ``my_function()``.
     
     Numbers
     =======
     
     ``my_function()`` returns the product of its arguments.  For numbers,
     that value is equivalent to using the ``*`` operator.
     
     ::
     
         >>> from doctest_in_help import my_function
         >>> my_function(2, 3)
         6
     
     It also works with floating point values.
     
     ::
     
         >>> my_function(2.0, 3)
         6.0
     
     Non-Numbers
     ===========
     
     Because ``*`` is also defined on data types other than numbers,
     ``my_function()`` works just as well if one of the arguments is a
     string, list, or tuple.
     
     ::
     
         >>> my_function('a', 3)
         'aaa'
     
         >>> my_function(['A', 'B', 'C'], 2)
         ['A', 'B', 'C', 'A', 'B', 'C']
     

[top] / python / PyMOTW / doctest / doctest_in_help.rst

contact | logmethods.com