Why does dynamic doc string do not work?
Dave Angel
d at davea.name
Tue Aug 21 13:30:39 EDT 2012
On 08/21/2012 12:44 PM, Miki Tebeka wrote:
> <snip>
>>> class B:
> ... '''a {} string'''.format('doc')
> ...
>>>> B.__doc__
>>>>
> <snip> I wonder why the first B docstring is empty. Thanks, -- Miki
According to some early documentation:
"convenient initialization of the |__doc__| attribute of modules,
classes and functions by placing a string literal by itself as the first
statement in the suite. It must be a literal -- an expression yielding a
string object is not accepted as a documentation string, since future
tools may need to derive documentation from source by parsing."
--
DaveA
More information about the Python-list
mailing list