mwh at python.net
Sun Dec 23 14:40:07 EST 2001
Igor Mozetic <igor.mozetic at uni-mb.si> writes:
> 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?
Try fname.__name__ or fname.func_name, but also try this:
g = f
> I'm restricted to Python 1.5.2.
> I'm not on the list, please reply to me.
More information about the Python-list