[Doc-SIG] Re: Attribute docstrings

Felix Wiemann Felix.Wiemann at gmx.net
Sun May 16 11:12:59 EDT 2004


Beni Cherniavsky wrote:

> [Proposal:] The examples from `PEP 258`__ then become::
>
>      """g
>          This is g's docstring."""
>      g = 'module attribute (module-global variable)'
>
> [snip]

I don't like, because it has redundancy -- the attribute name is
mentioned twice.

Another problem is that it's currently impossible to assign a new value
to an integer's docstring.

>>> a = 5
>>> a.__doc__ = "new docstring"
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'int' object attribute '__doc__' is read-only

So at the moment the only possibility to publicly and reliably document
an attribute is to document it in the parent object's docstring.

-- 
When replying to my email address, ensure that the mail header contains
'Felix Wiemann'. Please don't send unrequested mails > 64 KB.

<http://www.ososo.de/>




More information about the Doc-SIG mailing list