On Mar 21, 8:47 pm, "gtb" <[EMAIL PROTECTED]> wrote: > Greetings, > > Don't know the daily limit for dumb questions so I will ask one or > more. > > In a function I can use the statement n = > sys._getframe().f_code.co_name to get the name of the current > function. Given that I can get the name how can I print the __doc__ > string? I cant use the following, it will tell me to bugger off as the > string has no such attribute. > > def spam(self): > n = sys._getframe().f_code.co_name > print n.__doc__ #Wrong > print __doc__ #No good either > #....
print eval(n+'.__doc__') -- http://mail.python.org/mailman/listinfo/python-list