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


Groups > comp.lang.python > #9189

Re: Function docstring as a local variable

From "Colin J. Williams" <cjw@ncf.ca>
Subject Re: Function docstring as a local variable
Date 2011-07-10 18:28 -0400
References <mailman.842.1310319682.1164.python-list@python.org> <64b5198e-5cc7-4790-898e-7f1abb199230@y24g2000yqb.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.855.1310336914.1164.python-list@python.org> (permalink)

Show all headers | View raw


On 10-Jul-11 13:44 PM, rantingrick wrote:
> On Jul 10, 12:41 pm, Tim Johnson<t...@johnsons-web.com>  wrote:
>> It possible for a function to print it's own docstring?
>
> def f():
>     """docstring"""
>     print "docstring"
>
> any questions?

Try:

def f():
      ds= """docstring"""
      print ds
 >

Colin W.

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


Thread

Function docstring as a local variable Tim Johnson <tim@johnsons-web.com> - 2011-07-10 09:41 -0800
  Re: Function docstring as a local variable rantingrick <rantingrick@gmail.com> - 2011-07-10 10:44 -0700
    Re: Function docstring as a local variable "Colin J. Williams" <cjw@ncf.ca> - 2011-07-10 18:28 -0400
      Re: Function docstring as a local variable Ben Finney <ben+python@benfinney.id.au> - 2011-07-11 09:48 +1000
    Re: Function docstring as a local variable Corey Richardson <kb1pkl@aim.com> - 2011-07-10 19:00 -0400
      Re: Function docstring as a local variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-11 11:54 +1000
      Re: Function docstring as a local variable alex23 <wuwei23@gmail.com> - 2011-07-10 21:05 -0700

csiph-web