pudb
pudb copied to clipboard
Add global and "by reference" watches
Addresses #511
Allows modifying watch expressions in two ways:
- Whether to show the watch expression in all frames as opposed to only the current frame
- Whether to continually re-evaluate the watch expression or evaluate it when it is created, cache the result, and watch changes to this value over time. If the value appears in the current local or global namespaces, it's current name is shown in parentheses.
Actually what do you think of making all watches "global"? That's usually how I want watches to behave.
Hmm just as well I'm not entirely happy with the state of this- we don't have access to the right InspectInfo for global watches since it's still being cached at the frame level, so the global watches are presented differently (display type, show detail, etc) in each frame.
Also, any thoughts on the UI for this stuff? I went with "expression"/"reference" since that made sense to me at the time but "by name"/"by value" might make more sense. And how cumbersome is it to have potentially 4 different kinds of watches?
Haven't read up all the watch-related stuff, but here is a late night thought:
What about showing (some) watch values only when their evaluation does not fail? Put differently, hiding all watches that yield a WatchEvalError.
This is what comes to mind after seeing the behavior of https://github.com/inducer/pudb/pull/150, which saves watch expressions and loads them in every entered frame, which of course fails in many cases.