"Prasad, Ramit" <ramit.pra...@jpmchase.com> 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 '''
...  return 42
...
def g():
...  return f() + 10
...
g.__doc__ = "Here is g's help\n" + f.__doc__
help(g)
help(g)
Help on function g in module __main__:

g()
Here is g's help here is f's doc string



There may be a more elegant way but that seems to work...


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to