User Access to the docstring of a property

Colin J. Williams cjw at sympatico.ca
Fri Oct 20 10:17:00 EDT 2006


Is there some way that the user can access the docstring specified for a 
property?

Please see the example below:

# propDocTest
class A(object):
   def __init__(self, value):
     self.value= value
   def vGet(self):
     return self.value
   V= property (fget= vGet, doc="Get Value.")

a= A(22)
print a.vGet()
print a.V
print a.V.__doc__     # this gives the docstring for the value returned
help(a.V)             # this gives the docstring for the class/type of 
the value returned

Colin W.




More information about the Python-list mailing list