New submission from Erik Zoltan: 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 ---------- components: Library (Lib) files: zdebug.py messages: 291839 nosy: Erik Zoltan priority: normal severity: normal status: open title: PDB enhancement type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file46810/zdebug.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30094> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com