[BEGINNER] meta-functions

Richard Philips Richard.Philips at ua.ac.be
Wed Dec 26 12:26:31 EST 2001


Igor Mozetic wrote:

>A simple question from a newbie, sorry.
>
>I have functions defined normally, def fname(arg1,arg2):
>and also represented as tuples (fname, arg1, arg2),
>to use them by apply(fname, (arg1,arg2)) - no problem.
>
>How do I make a comparison:  fname == 'string' ?
>I found that I could use repr(fname) and parse the
>resulting string, but I consider this ugly.
>Is there a standard function to return a function name
>as a string?
>
>I'm restricted to Python 1.5.2.
>I'm not on the list, please reply to me.
>
>-Igor Mozetic
>
See:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52315


Richard Philips





More information about the Python-list mailing list