Advanced
Python
Q96 / 101
What is a Python traced function and how does sys.settrace work?
Correct! Well done.
Incorrect.
The correct answer is B) sys.settrace installs a callback called on each function call, line execution, and return, enabling debuggers and coverage tools
B
Correct Answer
sys.settrace installs a callback called on each function call, line execution, and return, enabling debuggers and coverage tools
Explanation
sys.settrace(handler) installs a per-thread trace function called for "call", "line", "return", "exception" events. pdb, coverage.py, and pytest use this mechanism.
Progress
96/101