Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Python, documentation strings within classes
  2. def func():  
  3.     """
  4.      doc string
  5.     """
  6.  
  7.  
  8. print func.__doc__
  9.        
  10. class MyClass(object):
  11.  
  12.     def __init__(self):
  13.         """
  14.         doc string
  15.         """
  16.  
  17. i = MyClass()  
  18. print i.__doc__
  19.        
  20. class MyClass(object):
  21.     """ Documentation for MyClass goes here. """
  22.  
  23.     def __init__(self):
  24.         """
  25.         doc string
  26.         """
  27.  
  28. i = MyClass()  
  29. print i.__doc__ # same as MyClass.__doc__
  30.        
  31. print i.__init__.__doc__
  32.        
  33. class MyClass(object):
  34.     ''' MyClass ... '''
  35.        
  36. help(i)