Function docstring as a local variable

python at python at
Mon Jul 11 00:13:29 CEST 2011

I'm not sure how a function can get a generic handle to itself, but if
you're willing to hardcode the function name, then this technique works:

def test():
    """This is my doc string"""
    print test.__doc__



This is my doc string


More information about the Python-list mailing list