"David Huard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 21 Jun 2006 15:39:02 +0200, Maric Michaud wrote: > > > This is w.__class__.x.__doc__. > > Thanks, > > So in order to implement what I want, I should rather consider an > ipython hack to print w.__class__.x.__doc__ when it exists, instead of > w.x.__doc_ ? Does this makes sense or it will ruin the standard behaviour? > > David > No need to, just assign your special docstrings to w.x.__doc__, and print w.x.__doc__. Instances that have special docstrings will print their instance-specific versions; instances without instance-specific docstrings will print the class-level version. See below.
-- Paul >>> class W(object): ... "Class-level docstring for W" ... pass ... >>> z = W() >>> z.__doc__ 'Class-level docstring for W' >>> z.__doc__ = "instance-level docstring, just for z" >>> z.__doc__ 'instance-level docstring, just for z' >>> zz = W() >>> print zz.__doc__ Class-level docstring for W >>> print z.__doc__ instance-level docstring, just for z -- http://mail.python.org/mailman/listinfo/python-list