Currently, the Python debugger (pdb) has a number of commands that are easily conflated with (prefixes of) Python statements. When a user intends the latter, the former get accidentally triggered instead, resulting in an annoying user experience.
For illustration, suppose the following are intended as Python statements. Instead, and perhaps surprisingly, they trigger unrelated pdb commands:
To disambiguate legitimate Python statements from pdb commands, they must be prefixed with !.
In practice, since it is
Difficult to remember exactly which identifiers are (prefixes of) pdb commands.
Cumbersome to have to repeatedly switch between using or not using !.
I usually end up prepending all entries intended as Python statements with !. This is annoying, and feels backward from a UX perspective.
IMO, it should be the other way around: It should be pdb commands that are prefixed with !. It is those commands that are “special”, not the opposite.
This also removes the arbitrary choice of using or not using !, resulting in a more uniform interface: If an entry is prefixed by !, it is a pdb command. Otherwise, it is a Python statement. Simple as that.
Indeed, ! is used for “bang magics” and other “meta-commands” in Jupyter Notebook, IPython, and other such settings, so there is precedent for this approach.
I wish the input parser could notice the ( after a command and from it infer that you want the function rather than the command.
Despite the slightly murky namespace munging, I do like the convenience of just typing u/d/b/c. I never have variable/command name conflicts because I don’t use single letter variable names.
Most of the issues you mentioned are already fixed in 3.13. I don’t believe we will enforce a ! prefix for all pdb commands because those are more commonly used in a debugger. I don’t believe gdb or lldb does that either.
I do think the ambiguity resolving is pretty bad in old pdb and that’s why I fixed a lot of them.