I have created a pdb enhancement that allows me to query an object's internals more gracefully. It is incredibly useful and it would be very easy to include this logic in the distribution version of pdb.
I created my own modification of pdb called zdebug (attached as zdebug.py) that implements a new ppp debugging command. This command prints a formatted output of an object's internals. It could be smoother, and doesn't fully obey the programming conventions used with in pdb, and I'm not proposing to submit it as a patch. However the ppp command is pretty simple and incredibly useful.
Here's a tiny example. I can drill into an object, see its internals, and interactively explore its property chain. (The zdebug.zbreak() call is equivalent to pdb.set_trace()).
$ python3
>>> from datetime import date
>>> today = date.today()
>>> import zdebug
>>> zdebug.zbreak()
--Return--
> <stdin>(1)<module>()->None
zdebug> p today
datetime.date(2017, 4, 18)
zdebug> ppp today
ctime = <built-in method ctime of datetime.date object at 0x7fc688a1cf50>
day = 18
fromordinal = <built-in method fromordinal of type object at 0x562b84a60d60>
fromtimestamp = <built-in method fromtimestamp of type object at 0x562b84a60d60>
isocalendar = <built-in method isocalendar of datetime.date object at 0x7fc688a1cf50>
isoformat = <built-in method isoformat of datetime.date object at 0x7fc688a1cf50>
isoweekday = <built-in method isoweekday of datetime.date object at 0x7fc688a1cf50>
max = 9999-12-31
min = 0001-01-01
month = 4
replace = <built-in method replace of datetime.date object at 0x7fc688a1cf50>
resolution = 1 day, 0:00:00
strftime = <built-in method strftime of datetime.date object at 0x7fc688a1cf50>
timetuple = <built-in method timetuple of datetime.date object at 0x7fc688a1cf50>
today = <built-in method today of type object at 0x562b84a60d60>
toordinal = <built-in method toordinal of datetime.date object at 0x7fc688a1cf50>
weekday = <built-in method weekday of datetime.date object at 0x7fc688a1cf50>
year = 2017
zdebug> p today.day
18
zdebug> p today.year
2017
|