diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 74bffef5562ae1..7fd3dfce7b1660 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -598,13 +598,22 @@ can be overridden by the local file. Delete the specified alias *name*. -.. pdbcommand:: ! statement +.. pdbcommand:: !statement Execute the (one-line) *statement* in the context of the current stack frame. The exclamation point can be omitted unless the first word of the statement - resembles a debugger command. To set a global variable, you can prefix the - assignment command with a :keyword:`global` statement on the same line, - e.g.:: + resembles a debugger command, e.g.: + + .. code-block:: none + + (Pdb) !next(some_iterator) + 42 + (Pdb) + + To set a global variable, you can prefix the assignment command with a + :keyword:`global` statement on the same line, e.g.: + + .. code-block:: none (Pdb) global list_options; list_options = ['-l'] (Pdb) diff --git a/Lib/pdb.py b/Lib/pdb.py index b3dc5a455e56b9..14b2a7bbf22fbf 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -1638,13 +1638,17 @@ def do_help(self, arg): do_h = do_help def help_exec(self): - """(!) statement + """(!)statement Execute the (one-line) statement in the context of the current stack frame. The exclamation point can be omitted unless the - first word of the statement resembles a debugger command. To - assign to a global variable you must always prefix the command - with a 'global' command, e.g.: + first word of the statement resembles a debugger command, e.g.: + (Pdb) !next(some_iterator) + 42 + (Pdb) + + To assign to a global variable you must always prefix the command with + a 'global' command, e.g.: (Pdb) global list_options; list_options = ['-l'] (Pdb) """ diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 1babb5ce9476c9..baa9fa1c3c940c 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -5277,17 +5277,21 @@ '\n' ' Delete the specified alias *name*.\n' '\n' - '! statement\n' + '!statement\n' '\n' ' Execute the (one-line) *statement* in the context of the ' 'current\n' ' stack frame. The exclamation point can be omitted unless the ' 'first\n' - ' word of the statement resembles a debugger command. To set ' - 'a\n' - ' global variable, you can prefix the assignment command with ' - 'a\n' - ' "global" statement on the same line, e.g.:\n' + ' word of the statement resembles a debugger command, e.g.:' + '\n' + ' (Pdb) !next(some_iterator)\n' + ' 42\n' + ' (Pdb)\n' + '\n' + ' To set a global variable, you can prefix the assignment command ' + ' with \n' + ' a "global" statement on the same line, e.g.:\n' '\n' " (Pdb) global list_options; list_options = ['-l']\n" ' (Pdb)\n'