我可以跟蹤python腳本中執行的所有函數/方法嗎?

[英]Can I trace all the functions/methods executing in a python script?


Is there a way to programmatically trace the execution of all python functions/methods? I would like to see what arguments each of them was called with. I really mean all, I'm not interested in a trace decorator.

有沒有辦法以編程方式跟蹤所有python函數/方法的執行?我想看看他們每個人被調用的論點。我真的是指所有人,我對跟蹤裝飾師不感興趣。

In Ruby, I could alias the method I wanted and add the extra behaviour there.

在Ruby中,我可以為我想要的方法添加別名,並在那里添加額外的行為。

1 个解决方案

#1


Have a look at the trace module.

看一下跟蹤模塊。

You can also use it via the command line:

您也可以通過命令行使用它:

python -m trace --help

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2009/06/17/7260173dbc3a1cc737d9480a0e704526.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com