[Numpy-discussion] numpy doc strings - a tool to list problem cases

Colin J. Williams cjw at sympatico.ca
Tue Mar 7 14:17:03 CST 2006

Some of the docstrings have lines which are too long.  Some names have 
no associated docstring.

The effects of this are that, for the long lines, the PyDoc generated 
documentation is difficult to read on a browser and,
for the missing cases, the generated docs are incomplete.

The question of how long is too long is a matter of personal choice.  I 
used 78 characters in the little script below that lists problem cases.

# to check numpy docs, for long and missing lines
import numpy
lst= dir(numpy)
lnMax= 78                               # maximum number characters per line
print 'Report of missing docstrings and docstrings with lines that are 
too long'
for nm in lst:
  txt= eval('numpy.' + nm + '.__doc__')
  if txt is None:
    print nm, 'No docstring'
  lns= txt.split('\n')
  for lnNo in range(len(lns)):
    ln= lns[lnNo]
    if len(ln) > lnMax:
      print nm, 'Line#:', lnNo, 'Line Length:', len(ln)
      z= 1
z= 1

Colin W.

More information about the Numpy-discussion mailing list