Standard way of documenting python code ?

Rony bucodi at ahoo.fr
Fri Nov 28 08:39:45 EST 2003


A question on python source documentation.
Does there exist a standard for documenting code ?
I've included here an example generated by pydoc of one of my modules.
Is this the right way or is it overkill ?
Comments are appreciated

Thanks,

Rony

Help on module sqlquery:

NAME
    sqlquery

FILE
    m:\plymouth\sqlquery.py

DESCRIPTION
   
#########################################################################
    # Module : sqlquery.py
    # Abstract : General, simple, SQL class
    #           Contains some simple classes
    #               connection(connectstring): connect to db and define
cursor
    #               cmd(command,logflag=None) : execute sql-command
    #               selcmd(dict,logflag=None) : execute select statement
    #               inscmd(dict,logflag=None) : execute insert statement
    # Dependancies : mylibs.sqlerreur.py
    #                mylibs.string_man.py
   
#########################################################################

CLASSES
    connection
    
    class connection
     |  Connection to odbc source defined in connecstring
     |  Public methods :
     |                      - close : close connection
     |                      - cmd : execute cmd and return result set
     |  
     |  Methods defined here:
     |  
     |  __init__(self, connectstring)
     |      Create db connection from connectstring
     |      Connect string must have the format 'odbc-source/user'
     |      Will create cursor called self.cursor
     |  
     |  close(self)
     |      Close database connection
     |  
     |  cmd(self, command, logresult=None)
     |      Execute a SQL-statement, returns the resultset als list
     |      if logresult != None then write result in log.txt
     |  
     |  inscmd(self, dict, logresult=None)
     |      Execute a INSERT command.
     |      The command is constructed out of a dictionary (dict)
     |      The dict should contain :
     |          "tocols" : list of destination cols as a string
     |          "tables" : table where to insert as a string
     |          "values"  : list of values to insert as a string
     |      Ex :
     |          {'tocols':'AC_ID,AC_NOM',
     |           'table':'TBL_ACHETEUR',
     |           'values':'1,'+quote('RONY')}
     |           will create : INSERT INTO TBL_ACHETEUR (AC_ID,AC_NOM)
     |                         VALUES(1,'RONY)
     |      If logresult != None then write result in log.txt
     |      Returns nothing
     |  
     |  selcmd(self, dict, logresult=None)
     |      Execute a SELECT command.
     |      The command is constructed out of a dictionary (dict)
     |      The dict should contain :
     |          "cols" : list of cols as a string
     |          "tables" : list of tables as a string
     |          "order"  : list of orders as a string
     |      Ex :
     |          {'cols':'AC_ID,AC_NOM',
     |           'tables':'TBL_ACHETEUR',
     |           'order':'AC_ID'}
     |           will create : SELECT AC_ID,AC_NOM FROM TBL_ACHETEUR
     |                         ORDER BY AC_ID
     |      If logresult != None then write result in log.txt
     |      Returns self.result

DATA
    achtdict = {'cols': 'AC_ID,AC_NOM', 'order': 'AC_NOM', 'tables':
'TBL_...
    connectstring = 'plymouth/sa/'
    insachdict = {'tables': 'TBL_TMP', 'tocols': 'TP_ID,TP_NOM',
'values':...



-- 
Rony

  /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 /   bucodi at yahoo.fr
/
|    www.bucodi.com - My work
\    www.ifrance/karamusique  -- My hobby
 \_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/






More information about the Python-list mailing list