Function docstring as a local variable

Colin J. Williams cjw at ncf.ca
Sun Jul 10 18:28:15 EDT 2011


On 10-Jul-11 13:44 PM, rantingrick wrote:
> On Jul 10, 12:41 pm, Tim Johnson<t... at 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.




More information about the Python-list mailing list