See https://docs.python.org/3/library/gettext.html.

'_' is the standard name for i18n conversion.

I am against any more standard renaming of breakpoint().  If someone wants to bind that to another name, they are free to.  The point isn't the length, but the memorability of the name.


On Wed, Dec 2, 2020 at 11:18 PM Qingyao Sun via Python-ideas <python-ideas@python.org> wrote:
Thanks for the reply!

> since 'b' is a common variable name (like all
short names are) and people would fall in the trap of forgetting that
there's a variable named 'b' in scope when they call 'b()'.

That's a good point. I should have seen this issue myself.

I have an alternative proposal to address this. What about `_ = breakpoint` instead? While `_` is still a short name, the only logical place a variable will be named as such is inside a for-loop to capture unused values, which I don't think is common enough to render the shorthand useless. In case there is a name collision, we can make a special error message pointing people to `breakpoint`. People are not expected to use a variable named `_` anyway.

> If you're having trouble typing 'breakpoint' maybe you can switch to an
editor that has some form of code completion. Or you can use the 'b =
breakpoint' trick yourself at the top of your file.

I have explained why these two workarounds cannot solve the issue in my original post. Could you re-read it? To paraphrase, this shorthand is for developers who are not a frequent user of pdb due to its unergonomic name, and there are cases where you don't have access to decent code completion (and having to switch to another editor is never comfortable).

From my understanding, the major contribution of PEP 553 is that it makes the debugger more accessible by replacing the 27-character command sequence `import pdb; pdb.set_trace()` with the 12-character `breakpoint()`. I want to take it one step further because 12 characters is still unnecessary wordy.


Qingyao
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/DUA2GUMTKVNDG47NNIQDLBHHF6SLSGLF/
Code of Conduct: http://python.org/psf/codeofconduct/


--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.