Module example
[hide private]
[frames] | no frames]

Source Code for Module example

 1  """This is the docstring for the example.py module.  Modules names should 
 2  have short, all-lowercase names.  The module name may have underscores if 
 3  this improves readability. 
 4   
 5  Every module should have a docstring at the very top of the file.  The 
 6  module's docstring may extend over multiple lines.  If your docstring does 
 7  extend over multiple lines, the closing three quotation marks must be on 
 8  a line by itself, preferably preceeded by a blank line. 
 9   
10  """ 
11  __docformat__ = "restructuredtext en" 
12   
13  import os                      # standard library imports first 
14   
15  import numpy as np             # related third party imports next 
16  import scipy as sp             # imports should be at the top of the module 
17  import matplotlib as mpl       # imports should usually be on separate lines 
18   
19 -def foo(var1, var2, long_var_name='hi') :
20 """One-line summary or signature. 21 22 Several sentences providing an extended description. You can put 23 text in mono-spaced type like so: ``var``. 24 25 Parameters 26 ---------- 27 var1 : array_like 28 Array_like means all those objects -- lists, nested lists, etc. -- 29 that can be converted to an array. 30 var2 : integer 31 Write out the full type 32 long_variable_name : {'hi', 'ho'}, optional 33 Choices in brackets, default first when optional. 34 35 Returns 36 ------- 37 named : type 38 Explanation 39 list 40 Explanation 41 of 42 Explanation 43 outputs 44 even more explaining 45 46 Other Parameters 47 ---------------- 48 only_seldom_used_keywords : type 49 Explanation 50 common_parametrs_listed_above : type 51 Explanation 52 53 See Also 54 -------- 55 otherfunc : relationship (optional) 56 newfunc : relationship (optional) 57 58 Notes 59 ----- 60 Notes about the implementation algorithm (if needed). 61 62 This can have multiple paragraphs as can all sections. 63 64 Examples 65 -------- 66 examples in doctest format 67 68 >>> a=[1,2,3] 69 >>> [x + 3 for x in a] 70 [4, 5, 6] 71 72 """ 73 74 pass
75 76
77 -def newfunc() :
78 """Do nothing. 79 80 I never saw a purple cow. 81 82 """ 83 84 pass
85 86
87 -def otherfunc() :
88 """Do nothing. 89 90 I never hope to see one. 91 92 """ 93 94 pass
95