I am currently debugging code using Python. I have not been using Python for a while. I put some breakpoints on a variable which is an integer. Let's say this variable is X = 10
. How can I:
X+2
and get the result?As noted in the comments, there are many possible IDEs you can use with Python. The original question was specifically about Eclipse and so my answer focuses on a solution using that IDE. Other solutions are possible if you prefer a different environment...
First off, you need to sort out which plug-in you use for eclipse. You have a few options as you can see on the python wiki. It looks like PyDev is more popular, but you could pick others.
Assuming you go for PyDev, you can use the watch facility as described here to evaluate any expression. Alternatively you can use the console debugger to evaluate code directly in the debugger.
EDIT: As per the comments, you can also open the Expressions window using Window > Show View > Other > Debug > Expressions
. This is the same window as used for the watch facility and the contents can be edited directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With