A Saturday 05 September 2009 20:56:53 escriguéreu: > Dear Francesc, > > Thanks. This appears to be the most complicated python code I'll ever > type in. I trust you that this is the most efficient answer, but it is > way beyond my wildest fantasies. If I recall well, you are a > physicist, like me, so you'll appreciate the following analogy. If you > want to add 1 to 2, you first have to realise that the proper meaning > of 1 is the set that contains the empty set, and that 2 is the set > that contains the empty set and the set that corresponds to 1. Then > we should properly define the plus operator such that operates on > sets. etc. > > Section 14.7 of my cookbook is actually on cookie handling. I suppose > you have edition 1 (or is 3 already out) of the cookbook. I'll do some > searching in my version of the cookbook. I already searched for this, > but missed the answer apparently. > You read the cookbook from cover to cover that you know this?
OK. Indeed, I've the first edition of the "Python Coobook". The name of the recipe is "Determining the Name of the Current Function". This is suggesting the next idiom for getting the name of the function: this_function_name = sys._getframe().f_code.co_name Now, what we need is to get a function object (in order to get the '__doc__' attribute later on). `eval()` provides a handy way to get the function from its name: this_function_object = eval(this_function_name) Finally, you only have to get the '__doc__' attribute: mydoc = getattr(this_function_object, "__doc__") Hope this is clearer now ;-) -- Francesc Alted ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users