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

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

Reply via email to