Discussion:
pdb: How to use the 'break' parameter?
(too old to reply)
Kevin M. Wilson
2024-08-22 01:44:35 UTC
Permalink
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]]

I'd be obliged for an assist... KMW
***************************************************
"When you pass through the waters, I will be with you: and when you pass through the rivers, they will not sweep over you. When you walk through the fire, you will not be burned: the flames will not set you ablaze."     
Isaiah 43:2
Peter J. Holzer
2024-08-22 06:08:46 UTC
Permalink
Post by Kevin M. Wilson
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.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Loading...