Recently someone mentioned they were trying to improve their python programming skills.
Attached is a python program than might help. It is called: create_module_list If create_module_list is executed for example like so: create_module_list string it will produce a file called: string_modules which contains a list of all the functions in string.py together with the documentation of each function. It will not work properly on packages. -- ======================================================================= A mathematician is a device for turning coffee into theorems. -- P. Erdos ======================================================================= Aaron Konstam telephone: (210) 656-0355 e-mail: [EMAIL PROTECTED]
#!/usr/bin/env python """ produces list of components in a python module """ """ Usage: create_module_list module_name """ import string, sys if len(sys.argv) == 1: print "Usage: create_module_list module_name " else: module = sys.argv[1] exec("import " + module) osmod= eval( "dir("+module + ")") file=open(module +"_modules","w") file.write(" List of "+ module+ " modules \n" + " ------------------ \n\n") index=0 while index < len(osmod): element=osmod[index] file.write(element + '\n') docum=eval(module +"." + element + ".__doc__") if docum != None: file.write(docum + '\n') file.write("\n" + "=========================================="+'\n') index = index+1 file.close()
_______________________________________________ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel