Extending The Python Debugger

The Problem

The Stuff That Didn’t Quite Work (But Is Cool To Know)

commands

alias

# Print instance variables (usage "pi classInst")
alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
# Print instance variables in self
alias ps pi self

pdbrc

display

Building Your Own Pdb

Using Your Pdb With The breakpoint Builtin

import pdb; pdb.set_trace()
import ipdb; ipdb.set_trace()
breakpoint()
❯ PYTHONBREAKPOINT=hookpdb.set_trace python
Python 3.9.5 (default, May 14 2021, 00:00:00)
[GCC 10.3.1 20210422 (Red Hat 10.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> breakpoint()
Welcome to HookPdb
--Return--
> /home/ajmal/playground/gevent-hang/hookpdb.py(75)set_trace()->None
-> mypdb.set_trace()
(Pdb)

Concluding Words

--

--

--

Full-stack JavaScript developer and coding enthusiast. I love learning new technologies and sharing my knowledge. Find me on ajmalsiddiqui.me

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Contributing factors for outstanding deliverables

Eggs and Building Puzzle

Converting Date, Time, and Timezones in Python — Includes: Epoch, ISO8601, 24 Hr, 12 Hr

AWS Elastic Beanstalk

Docker and Kubernetes | Strategies for Running Kubernetes Components with Up-to-Date Docker Images

MySQL 8.0.22 | Select Function(Sum, Avg, Count, Max, Min)

How to Install PostgreSQL 13 server on Windows

Open Application Model: Carving building blocks for Platforms

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mohammed Ajmal Siddiqui

Mohammed Ajmal Siddiqui

Full-stack JavaScript developer and coding enthusiast. I love learning new technologies and sharing my knowledge. Find me on ajmalsiddiqui.me

More from Medium

Python Functions and Packages:

Find Difference Between Numbers In Array Using np.diff — pythonpip.com

Customize keyboard shortcut keys using python

Generator in Python