1
paulw54jrn 2014-06-19 14:13:29 +08:00
http://stackoverflow.com/questions/10330119/how-to-backtrace-a-function-in-python-2-7
搬运工 import traceback def foo(): bar() def bar(): baz() def baz(): traceback.print_stack() # or trace = traceback.extract_stack() foo() |
2
poke707 OP @paulw54jrn 这个不太合适,我想的是在函数体内把"纯净的"函数状态引用出来
比如foo=__func__这样 |
3
miaoever 2014-06-19 14:31:37 +08:00 1
|
4
YufunHe 2014-06-19 14:33:11 +08:00
reflect
|
5
poke707 OP |
6
xylophone21 2014-06-21 21:00:41 +08:00
import traceback
def foo(): bar() def bar(): foobar() def foobar(): traceback.print_stack() if __name__ == '__main__': foo() 是要这个吗? |