How do I get the name of a function or method from within a Python function or method?

后端 未结 5 1359
一向
一向 2020-11-29 23:06

I feel like I should know this, but I haven\'t been able to figure it out...

I want to get the name of a method--which happens to be an integration test--from inside

5条回答
  •  无人及你
    2020-11-29 23:27

    I think the traceback module might have what you're looking for. In particular, the extract_stack function looks like it will do the job.

提交回复
热议问题