I am working on Python and I am passing a parameter named id
to my fucntion and i want to pause the execution for debugging purpose (check the value of response) if and only if the value of id is equal to ‘586982’.
But the execution is getting paused for all values of id irrespectively of ==
and =
.
I tried the following cases:
- id = 586982
- id == 586982
- id = "586982"
- id == "586982"
I tried to find a solution but i am not getting any.
Note: I changed variable name since id
is a built in keyword in python but its still not working
2
Answers
If the variable
id
is an int, the condition should be written:id == 586982
. If it is a string :id == "586982"
.However,
id
is normally a python function used to get the identifier of an object:id(your_object)
. I am guessing that you have overridden it, which is not a good practice. There is likely somewhere in your code something like:id = some_text_or_some_int
.I made a simple reproduction and didn’t encounter this problem.
After you entered the expression, you have to press Enter to save the breakpoint.
For example: