On 10/2/2017 10:45 AM, Guido van Rossum wrote:
On Sun, Oct 1, 2017 at 11:15 PM, Terry Reedy <tjreedy@udel.edu <mailto:tjreedy@udel.edu>> wrote:
On 10/2/2017 12:44 AM, Guido van Rossum wrote:
- There's no rationale for the *args, **kwds part of the breakpoint() signature. (I vaguely recall someone on the mailing list asking for it but it seemed far-fetched at best.)
If IDLE's event-driven GUI debugger were rewritten to run in the user process, people wanting to debug a tkinter program should be able to pass in their root, with its mainloop, rather than having the debugger create its own, as it normally would. Something else could come up.
But if they care so much, they could also use a small wrapper as the sys.breakpointhook that retrieves the root and calls the IDLE debugger with that.
'They' include beginners that need the simplicity of breakpoint() the most.
Why is adding the root to the breakpoint() call better than that? To me, the main attraction for breakpoint is that there's something I can type quickly and insert at any point in the code.
I agree.
During a debugging session I may try setting it in many different places. If I have to also pass the root each time I type "breakpoint()" that's just an unnecessary detail compared to having it done automatically by the hook.
Even though pdb.set_trace re-initializes each call, idb.whatever should *not*. So it should set something that can be queried. My idea was that a person should pass root only on the first call. But that founders on the fact that 'first call' may not be deterministic. if cond: breakpoint() <stuff> <more stuff> breakpoint() Besides which, someone might insert breakpoint() before creating a root. So I will try instead initializing with iroot = tk._default_root if tk._default_root else tk.Tk() and stick with iroot.update() and avoid i.mainloop() A revised tk-based debugger, closer to pdb than it is now, will require some experimentation. I would like to be able to use it to debug IDLE run from a command line, and that will be a fairly severe test of compatibility with a tkinter application. You could approve breakpoint() without args now and add them if and when there were more convincing need. -- Terry Jan Reedy