getting the function name

Sean Ross seandavidross at hotmail.com
Fri Sep 17 15:03:11 EDT 2004


"Russell Blau" <russblau at hotmail.com> wrote in message
news:2r0n4cF14n79gU1 at uni-berlin.de...
> <beliavsky at aol.com> wrote in message
> news:3064b51d.0409170927.584a10b3 at posting.google.com...
> > Is there a way in Python to print the name of the function one is
> > currently in?
>
> Google is your friend:
>
>
http://groups.google.com/groups?threadm=bado6f%24rgf%241%40driftwood.ccs.carleton.ca&rnum=1
>

Hi.

The posting that the above link refers to was made by me, but I'd like to
suggest that you do not use the code presented there (def WhoMightIBe()).
That was just a bit of a failed experiment to see whether I could track down
the name of a function _after_it_had_been_aliased_. What the OP wants is the
recipe (by Alex Martelli [1]) quoted in the posting I  made previous to this
one. I regret posting that experiment now - It was fun to try, but I think
it casts more shadow than light.

Good luck,
Sean

[1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062





More information about the Python-list mailing list