[wingide-users] breakpoint on variable

Yann Leboulanger asterix at lagaule.org
Thu Aug 26 03:22:22 MDT 2010

On 08/26/2010 04:39 AM, Luc Bourhis wrote:
> Hi Yann,
>> I'd like to know if it's possible to have some sort of breakpoint when a variable changes.
>> Let's say I have a class with a self.my_var variable, and I'd like program to stop when the code changes this variable.
>> Is it something doable?
> Hiding your actual variable behind a property is a nice trick to achieve what you wish for:
> class your_class(object):
> 	def _():
> 		def fget(self):
> 			return self._my_var
> 		def fset(self, value):
> 			self._my_var = value<<<<<<<<<<<<<<<<<<<<<
> 		return locals()
> 	my_var = property(**_())
> The rest of your code does not need to be touched in any way and you would then put a breakpoint at the line marked with<<<<<<
> By putting a breakpoint in the getter, you can even stop every time self.my_var has its value read by user-code.
> HtH,
> Luc

Nice workarround, thanks, that will do exactly what I want.


More information about the wingide-users mailing list