On Dec 25, 2012 6:06 PM, "Abhas Bhattacharya" <abhasbhattachar...@gmail.com>
wrote:
>
> While I am defining a function, how can I access the name (separately as
string as well as object) of the function without explicitly naming
it(hard-coding the name)?
> For eg. I am writing like:
> def abc():
>     #how do i access the function abc here without hard-coding the name?

Not possible per se without resorting to sys._getframe() or similar hackery.
A simple+elegant way to do this would require PEP 3130 (
http://www.python.org/dev/peps/pep-3130/ ) or similar, but that particular
proposal got rejected.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to