Lasse Vågsæther Karlsen wrote:
> So, my question is, is there a way to get __doc__ support for
> properties, in effect, use the """xxx""" syntax for documenting properties.

Yes, the property() function accepts a doc argument, as in:

property(fget, fset, fdel, doc)

ex:
MyProp = property(_get, _set, None, "This will show up in __doc__")


> Is the preferred way to use """xxx""" or # to document ?

# is for source code commenting (audience is the person reading your
code). """x""" is for documenting your API (audience is the person using
your code). They are quite different.


> Whatever is preferred, what's the upside/downsides of the two beyond
> what I just explained?

Nothing really, but something handy to keep in mind is that the string
literal ("""x""") can be used to block out huge sections of code during
testing, where you'd have to put a # in front of every line otherwise.

-- 
Paul McNett
http://paulmcnett.com
http://dabodev.com


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

Reply via email to