[Python-Dev] PEP 553: Built-in debug() (original) (raw)
Barry Warsaw barry at python.org
Wed Sep 6 20:20:17 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 553: Built-in debug()
- Next message (by thread): [Python-Dev] PEP 553: Built-in debug()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sep 6, 2017, at 16:55, Fernando Perez <fperez.net at gmail.com> wrote:
If I may suggest a small API tweak, I think it would be useful if breakpoint() accepted an optional header argument. In IPython, the equivalent for non-postmortem debugging is IPython.embed, which can be given a header. This is useful to provide the user with some information about perhaps where the breakpoint is coming from, relevant data they might want to look at, etc:
_ _from IPython import embed_ _def f(x=10):_ _y = x+2_ _embed(header="in f")_ _return y_ _x = 20_ _print(f(x))_ _embed(header="Top level")_ _
I understand in most cases these are meant to be deleted right after usage and the author is likely to have a text editor open next to the terminal where they're debugging. But still, I've found myself putting multiple such calls in a code to look at what's going on in different parts of the execution stack, and it can be handy to have a bit of information to get your bearings. Just a thought...
Thanks Fernando, this is exactly the kind of feedback from other debuggers that I’m looking for. It certainly sounds like a handy feature; I’ve found myself wanting something like that from pdb from time to time.
The PEP has an open issue regarding breakpoint() taking *args and **kws, which would just be passed through the call stack. It sounds like you’d be in favor of that enhancement.
Cheers, -Barry
-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 273 bytes Desc: Message signed with OpenPGP URL: <http://mail.python.org/pipermail/python-dev/attachments/20170906/960efaac/attachment.sig>
- Previous message (by thread): [Python-Dev] PEP 553: Built-in debug()
- Next message (by thread): [Python-Dev] PEP 553: Built-in debug()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]