gaogaotiantian / watchpoints

watchpoints is an easy-to-use, intuitive variable/object monitor tool for python that behaves similar to watchpoints in gdb.
Apache License 2.0
497 stars 20 forks source link

Need conditional expressions #4

Closed rswgnu closed 3 years ago

rswgnu commented 3 years ago

Great idea, as are all of your repos.

This really needs the ability to limit prints to only when certain boolean expressions are true that utilize the watchpoint variable. Otherwise, the logs could get too big too fast. Are conditional expressions already in there?

gaogaotiantian commented 3 years ago

Oops, I forgot that conditional callback is already there. Ignore the comments below and check when argument.

The tricky part of conditional expression is that the conditional check could potentially be in any scope, and you really do not have control of what variable you can have access to. I would definitely think about whether it's possible to add intuitive conditional check in watchpoints. However, at this point, you could always implement your own callback function, where you can basically do anything you want with the observing object.