Sujet : Re: pdb: How to use the 'break' parameter?
De : hjp-python (at) *nospam* hjp.at (Peter J. Holzer)
Groupes : comp.lang.pythonDate : 22. Aug 2024, 07:08:46
Autres entêtes
Message-ID : <mailman.63.1724307318.2890.python-list@python.org>
References : 1 2 3
Pièces jointes : signature.asc (application/pgp-signature) On 2024-08-22 01:44:35 +0000, Kevin M. Wilson via Python-list wrote:
break (Old_MacDonald:23 | name[indx] == 'd', indx = 4), based on the doc spec in python.org (https://docs.python.org/3/library/pdb.html#debugger-commands)
Cell In[1], line 20
break (Old_MacDonald:23 | name[indx] == 'd', indx = 4)
^
SyntaxError: invalid syntax
I got one blank white screen when I entered the exact first line of the python.org-->b(reak) [([filename:]lineno | function) [, condition]]
You misunderstood the notation. The | means "or", it is not something
you have to type literally.
So the syntax is:
either a line number (maybe in a different file) or a function name
optionally followed by a condition after a comma
So in your case probably something like:
break Old_MacDonald:23, name[indx] == 'd'
(I'm not sure what "indx = 4" was supposed to do. You can't assign
inside of a condition.)
hp
-- _ | Peter J. Holzer | Story must make more sense than reality.|_|_) | || | | hjp@hjp.at | -- Charles Stross, "Creative writing__/ | http://www.hjp.at/ | challenge!"