Name of the function
Francis Avila
francisgavila at yahoo.com
Fri Jan 9 16:04:03 EST 2004
anton muhin wrote in message ...
>Olaf Meding wrote:
>> Is there a way to do this w/o importing another module?
You could use sys instead, which is IIRC initialized at python start-up,
even though the name isn't put in the namespace until 'import sys'. So
strictly speaking, it's still importing, but there is no overhead.
sys._getframe().f_code.co_name
>> Yes this is what I was looking for except the code below requires
>> importing module inspect.
>I'm afraid that there is no way, at least none I'm aware of (except for
>Terry Reed suggestion, but I think it's not what you are looking for).
>
>Why you don't want to import a module?
I'll second that. I'll even ask why you want the original binding name of
the function. (When functions are first-class, the "name of the function"
becomes a bit meaningless.) What are you doing? We might be able to
suggest something better.
--
Francis Avila
More information about the Python-list
mailing list