Professional Python Debugging
Effective debugging saves hours of development time.
Using pdb
import pdb
def buggy_function(x):
pdb.set_trace() # Breakpoint
result = x / 0
return result
Logging Instead of Print
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
logger.debug("Debug message")
logger.info("Info message")
logger.error("Error message")
Discussion 0
No comments yet. Be the first to start the discussion!
Leave a Comment