Colin J. Williams wrote:
> Is there some way that the user can access the docstring specified for a
> property?

Do keep in mind that the docstring is not guaranteed to be available.
If
the application is run with optimization turned on, docstrings are
usually
optimized out.  Docstrings are handy for reading code and maybe for
debugging, but should not be relied upon for "users", as opposed to
developers.

-- George Young

> 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.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to