Re: Why does dynamic doc string do not work?

2012-08-21 Thread Miki Tebeka
Thanks! > On 08/21/2012 12:44 PM, Miki Tebeka wrote: > > > > > >>> class B: > > > ... '''a {} string'''.format('doc') > > > ... > > B.__doc__ > > > > > I wonder why the first B docstring is empty. Thanks, -- Miki > > > > According to some early documentation: > >

Re: Why does dynamic doc string do not work?

2012-08-21 Thread Dave Angel
On 08/21/2012 12:44 PM, Miki Tebeka wrote: > >>> class B: > ... '''a {} string'''.format('doc') > ... B.__doc__ > I wonder why the first B docstring is empty. Thanks, -- Miki According to some early documentation: "convenient initialization of the |__doc__| attribute of modu

Re: Why does dynamic doc string do not work?

2012-08-21 Thread Steven D'Aprano
On Tue, 21 Aug 2012 09:44:10 -0700, Miki Tebeka wrote: > Greetings, > class A: > ... '''a doc string''' > ... A.__doc__ > 'a doc string' class B: > ... '''a {} string'''.format('doc') ... B.__doc__ > Is there's a reason for this? Yes. Python only generates

Re: Why does dynamic doc string do not work?

2012-08-21 Thread Ian Kelly
On Tue, Aug 21, 2012 at 11:09 AM, Ian Kelly wrote: > On Tue, Aug 21, 2012 at 10:44 AM, Miki Tebeka wrote: >> Greetings, >> > class A: >> ... '''a doc string''' >> ... > A.__doc__ >> 'a doc string' > class B: >> ... '''a {} string'''.format('doc') >> ... > B.__doc__ > >

Re: Why does dynamic doc string do not work?

2012-08-21 Thread MRAB
On 21/08/2012 17:44, Miki Tebeka wrote: Greetings, class A: ... '''a doc string''' ... A.__doc__ 'a doc string' class B: ... '''a {} string'''.format('doc') ... B.__doc__ Is there's a reason for this? I know I can do: class B: ...__doc__ = '''a {} string'''.format('doc')

Re: Why does dynamic doc string do not work?

2012-08-21 Thread Ian Kelly
On Tue, Aug 21, 2012 at 10:44 AM, Miki Tebeka wrote: > Greetings, > class A: > ... '''a doc string''' > ... A.__doc__ > 'a doc string' class B: > ... '''a {} string'''.format('doc') > ... B.__doc__ > > Is there's a reason for this? > > I know I can do: class B

Why does dynamic doc string do not work?

2012-08-21 Thread Miki Tebeka
Greetings, >>> class A: ... '''a doc string''' ... >>> A.__doc__ 'a doc string' >>> class B: ... '''a {} string'''.format('doc') ... >>> B.__doc__ >>> Is there's a reason for this? I know I can do: >>> class B: ...__doc__ = '''a {} string'''.format('doc') And it'll work, but I wo