ISO all functions+methods+classes without docstring

K

kj

I'm looking for a good way to get a listing of all the undocumented
(i.e. docstring-less) functions, classes, and methods as defined
in a (largish) library of files.

What's a good way to get this information?

TIA!

-Kynn
 
S

Steven D'Aprano

I'm looking for a good way to get a listing of all the undocumented
(i.e. docstring-less) functions, classes, and methods as defined in a
(largish) library of files.

What's a good way to get this information?


list_of_modules = []
for module_name in list_of_files:
list_of_modules.append( __import__(module_name) )

for module in list_of_modules:
for name in dir(module):
obj = getattr(module, name)
doc = getattr(obj, '__doc__', None)
if doc is None:
print module, name


The only complication is that dir deliberately only shows "interesting"
attributes, however that is defined. If this doesn't do what what you
want, you may prefer to write your own function. The inspect module will
probably come in handy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top