Conditional breakpoints may be the closest you can get, but they trigger when an expression evaluates to True.
I don't think conditionals support any arbitrary change in a variable though.
A temporary code hack I've used to achieve a break on an arbitrary change is to add a new variable that keeps track of the old value and then set the break-point condition to when the old and new don't match.
Semen wrote:
Is there any way to get watchpoints functionality? I mean breakpoint on variable changes.
Conditional breakpoints may be the closest you can get, but they trigger when an expression evaluates to True.
I don't think conditionals support any arbitrary change in a variable though.
A temporary code hack I've used to achieve a break on an arbitrary change is to add a new variable that keeps track of the old value and then set the break-point condition to when the old and new don't match.
Rob
conditional breakpoints are too far..
one of workarounds I can see - is to mask variable with descriptor and set breakpoint on setter.
but that mess the code and may cause issues with changed type (from attribute type to descriptor)
can't believe there're no watchpoints in python debugger.
http://bugs.python.org/issue5654
Hello,
There is no such feature in PyCharm at the moment (nor, as far as I understand,
in any of the other Python IDEs). As far as I understand, the only way it
can be implemented is by running your entire program in single-step mode
and evaluating the variable after every step, which would slow down the execution
drastically.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Dmitry,
Has anything changed in regard to watchpoints in PyCharm since your comment?
Questions on Stackoverflow asking for this feature:
Stop at the line where a variable gets changed
How can I make PyCharm break when a variable takes a certain value?
Suspend debugger when a variable value changes
For reference I found this was rised as Support Data breakpoints PyCharm issue.
I would welcome a feature like this in PyCharm as well.