[Python-Dev] PEP 553: Built-in debug()

Barry Warsaw barry at python.org
Wed Sep 6 10:39:09 EDT 2017

On Sep 5, 2017, at 20:15, Guido van Rossum <guido at python.org> wrote:
> Yeah, I like the idea, but I don't like the debug() name -- IIRC there's a helper named debug() in some codebase I know of that prints its arguments under certain circumstances.
> On Tue, Sep 5, 2017 at 7:58 PM, Nathaniel Smith <njs at pobox.com> wrote:
> Maybe breakpoint() would be a better description of what set_trace()
> actually does?

Originally I was thinking of a keyword like ‘break here’, but once (after discussion with a few folks at the sprint) I settled on a built-in function, I was looking for something concise that most directly reflected the intent.  Plus I knew I wanted to mirror the sys.*hooks, so again I looked for something short.  debug() was the best I could come up with!

breakpoint() could work, although would the hooks then be sys.breakpointhook() and sys.__breakpointhook__?  Too bad we can’t just use break() :).

Guido, is that helper you’re thinking of implemented as a built-in?  If you have a suggestion, it would short-circuit the inevitable bikeshedding.

> This would also avoid confusion with IPython's very
> useful debug magic:
>     https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-debug
> and which might also be worth stealing for the builtin REPL.
> (Personally I use it way more often than set_trace().)

Interesting.  I’m not an IPython user.  Do you think its %debug magic would benefit from PEP 553?

(Aside: improving/expanding the stdlib debugger is something else I’d like to work on, but this is completely independent of PEP 553.)


-------------- 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/bb0f36b4/attachment.sig>

More information about the Python-Dev mailing list