access __doc__ from within function without reference to function name
SanPy
jhmsmits at gmail.com
Tue Oct 2 09:26:07 EDT 2007
The subject of this message might be a little cryptic, so here's an
example of what I mean:
def foo():
"""doc string of foo"""
print foo.__doc__
>>> foo()
doc string of foo
What I want to know is whether it is possible to call __doc__ against
some builtin method, like __func__ or something like that. So calling
__doc__ without the functions name, something like this:
def foo():
"""doc string of foo"""
print __func__.__doc__ # pseudo code
So basically, my question is: is there a way to access a function from
within itself without using its name?
Regards, Sander.
More information about the Python-list
mailing list