> I knew I could set the docstring (and played with it) but I did
> not realize that would work when the function is imported
> from a module!
You are changing the doc string of the function in the same
module, you couldn't change the docstring of a function in
another module - or at least
-Original Message-
From: tutor-bounces+ramit.prasad=jpmchase@python.org
[mailto:tutor-bounces+ramit.prasad=jpmchase@python.org] On Behalf Of Alan
Gauld
Sent: Thursday, May 26, 2011 7:20 PM
To: tutor@python.org
Subject: Re: [Tutor] nested / concatenated function docstrings
"Prasad, Ramit" wrote
I would like to have the docstring for function first also
contain the docstring for second because it should
support/pass any argument second contains.
You can explicitly set the docstring by assigning to __doc__:
def f():
... '''here is f's doc string '''
...
Module 1:
Def first(arg1,arg2, *args, **kwargs):
# some code that wraps around second(*args, **kwargs)
Module 2:
Def second(...):
# some code here
Function first is basically a wrapper around second. Both are generators but
first is more refined/selective about what it yields. I would l