I am trying to track down when did a variable gets updated. I have a watcher, but is there anyway to set up so the execution will get paused when the value is getting updated ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Currently pycharm does not have a default built-in feature that tracks variable modification in real time. Alternatively you can do this:
- run debug
- From debugger pane -> Variables, right click the variable you would like to track and and add it to Watches.
- In Watches pane, right click the variable and select referring objects.
The feature you are talking about is, I believe, called watchpoint support and according to this article: http://sourceforge.net/blog/watchpoints-in-python/ Eric and PyScriptor has the feature but not pycharm.
回答2:
You can add a breakpoint in the line you need to watch and right-click it. Then in the dialog box you have "condition" as last input: add a condition that uses the variable you need and it should stop when you set it to.