Documenting properties

Lasse Vågsæther Karlsen lasse at vkarlsen.no
Tue Sep 27 14:07:58 EDT 2005


I notice that if I use this syntax:

def classname:
     ...
     ##
     # closes the database connection and releases the resources.
     def close(self):
         ....

     ##
     # Returns a list of fields
     fields = property(....)

then doing:

help (classname)

then the text is listed for the property and the method, whereas if I do
this:

classname.close.__doc__

then nothing is listed, and to get that I have to use the """.."""
syntax to document:

     def close(self):
         """closes the datab..."""
         ....

then classname.close.__doc__ shows the text.

So, my question is, is there a way to get __doc__ support for
properties, in effect, use the """xxx""" syntax for documenting properties.

Is the preferred way to use """xxx""" or # to document ?
Whatever is preferred, what's the upside/downsides of the two beyond
what I just explained?

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:lasse at vkarlsen.no
PGP KeyID: 0x2A42A1C2



More information about the Python-list mailing list