這是一個實用程式模組,可協助使用以下功能偵錯 python 來源
該模組在幾個關鍵方面為開發人員提供協助,特別是在偵錯和維護程式碼方面。以下是主要好處:
透過利用 whoami、whereami、whocalledme、calledtree 和 whosdaddy,開發人員可以創建更健壯、可維護且更易於調試的程式碼。
from pdbwhereami import whoami, whereami, whocalledme, calledtree, whosdaddy def debug_utility(): whoami() whoami("I am in test_whoami function") print() whereami() whereami("I am in test_whereami") whereami(obsolete_path = True) whereami(path_depth=6) print() whocalledme() whocalledme(obsolete_path = True) whocalledme(path_depth=6) print() calledtree() tstr = calledtree(verbose=False) print(tstr) calledtree(tree_depth=1) calledtree(tree_depth=2) print() whosdaddy() debug_utility()
[debug_utility] -> [debug_utility] -> I am in test_whoami function [whereami/main.py:71]:debug_utility -> [whereami/main.py:72]:debug_utility -> I am in test_whereami [/home/bhagavan/whereami/main.py:73]:debug_utility -> [/home/bhagavan/whereami/main.py:74]:debug_utility -> [whereami/main.py:93]:<module> -> [/home/bhagavan/whereami/main.py:93]:<module> -> [/home/bhagavan/whereami/main.py:93]:<module> -> #1[/home/bhagavan/whereami/main.py:84]:debug_utility <-- #0[/home/bhagavan/whereami/main.py:93]:<module> <-- #1[/home/bhagavan/whereami/main.py:85]:debug_utility <-- #0[/home/bhagavan/whereami/main.py:93]:<module> <-- #0[/home/bhagavan/whereami/main.py:87]:debug_utility <-- #1[/home/bhagavan/whereami/main.py:88]:debug_utility <-- #0[/home/bhagavan/whereami/main.py:93]:<module> <-- [<module>] ->
pip install pdbwhereami
git clone https://github.com/bhagavansprasad/pdbwhereami.git cd pdbwhereami pip insall ./
以上是Python 偵錯實用程式的詳細內容。更多資訊請關注PHP中文網其他相關文章!