Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27587

Re: Why does dynamic doc string do not work?

Newsgroups comp.lang.python
Date 2012-08-21 10:40 -0700
References <3a128081-7f5d-4641-bc5d-8cffe64f5eee@googlegroups.com> <mailman.3613.1345570273.4697.python-list@python.org>
Subject Re: Why does dynamic doc string do not work?
From Miki Tebeka <miki.tebeka@gmail.com>
Message-ID <mailman.3614.1345570807.4697.python-list@python.org> (permalink)

Show all headers | View raw


Thanks!

> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why does dynamic doc string do not work? Miki Tebeka <miki.tebeka@gmail.com> - 2012-08-21 09:44 -0700
  Re: Why does dynamic doc string do not work? Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-21 11:09 -0600
  Re: Why does dynamic doc string do not work? MRAB <python@mrabarnett.plus.com> - 2012-08-21 18:16 +0100
  Re: Why does dynamic doc string do not work? Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-21 11:21 -0600
  Re: Why does dynamic doc string do not work? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-21 17:22 +0000
  Re: Why does dynamic doc string do not work? Dave Angel <d@davea.name> - 2012-08-21 13:30 -0400
    Re: Why does dynamic doc string do not work? Miki Tebeka <miki.tebeka@gmail.com> - 2012-08-21 10:40 -0700
    Re: Why does dynamic doc string do not work? Miki Tebeka <miki.tebeka@gmail.com> - 2012-08-21 10:40 -0700

csiph-web