Re: Get the name of a function

2011-08-05 Thread Grant Edwards
On 2011-08-05, gervaz wrote: > Hi all, is there a way to retrive the function name like with > self.__class__.__name__? Not really. There may not be any such thing as "the function name". A function may have zero names, it may have a dozen names. It may have names but only in namespaces that a

Re: Get the name of a function

2011-08-05 Thread Chris Rebert
On Fri, Aug 5, 2011 at 11:52 AM, gervaz wrote: > Hi all, is there a way to retrive the function name like with > self.__class__.__name__? > > Using self.__dict__.__name__ I've got > def test(): > ...     print(self.__dict__.__name__) > ... Er, where did `self` magically come from? test

Re: Get the name of a function

2011-08-05 Thread Emile van Sebille
On 8/5/2011 11:52 AM gervaz said... Hi all, is there a way to retrive the function name like with self.__class__.__name__? yes, but not reliably: Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information.