Comments (4)
Three remarks:
- What does 'changed' mean?
current_value is not previous_value
? bdb
doesn't provide any help with this. So pudb would have to do this on its own, which would potentially be quite expensive. Also, what should it do if the current scope is exited?- Watch expressions are going to stay what they are--expressions whose values you'd like to see ("watch"). Data-changed breakpoints are a different matter.
from pudb.
OK, I didn't put much thought into it yet :)
I just noticed that I wanted this feature today when I was trying to figure out the first time in a module that a variable became defined, and the best way I could figure out to do it was to set it as a watch expression and press n
until I saw the value change.
To answer your questions:
What does 'changed' mean? current_value is not previous_value?
I guess we should experiment with performance, but probably we should let the user customize this. It should be either is
comparison or comparison against the string form. Anything else is potentially dangerous anyway (e.g., ==
), not to mention not guaranteed to work.
bdb doesn't provide any help with this. So pudb would have to do this on its own, which would potentially be quite expensive. Also, what should it do if the current scope is exited?
OK, I didn't know that. I'll have to think about how to implement this then.
Watch expressions are going to stay what they are--expressions whose values you'd like to see ("watch"). Data-changed breakpoints are a different matter.
I guess watch expressions are the wrong way to think about this. Better would be to add a new checkbox for the dialog that comes up when you press enter
on a variable, which would enable this tracking. It would also work for watch expressions.
Actually, thinking about how to implement this, it would be harder to do for a watch expression--and potentially much more expensive. I think you'd have to somehow add a hook to the locals dictionary, which has a callback to PuDB if the variable changes. This may or may not work (from my understanding, the locals dictionary is not really a dictionary, so such a hook may not work. I also don't know what kinds of optimizations exist for it). Making it work for watch expressions would be trickier: the hook would have to reevaluate the watch expression each time the locals dictionary is accessed. There are also subtleties if you want to support attributes with new/old-style classes and __slots__
and so on.
So all in all, this is definitely a hard problem. But it might be fun to learn more about the Python internals. And I don't think there's any question that it would be a useful feature.
If my locals hack doesn't work, I suppose we could have PuDB "n
" continually until the expression changes (without updating the UI each time). That would indeed be slow: each Python statement would be reduced to running at the speed of a Python loop, but there's always at least some speed tradeoff given if you are using a debugger.
from pudb.
locals falls short. You might want to break on a changed instance attribute...
from pudb.
Looks like with code from https://github.com/cool-RR/PySnooper it is possible to cover this.
from pudb.
Related Issues (20)
- remote debugging - Cannot disable application log message from garbling up the PuDB UI screen HOT 3
- Pudb UI Exception Encountered: Object 'A' appears to be a sequence, but does not behave like one: iteration over a 0-d tensor HOT 1
- Disable "view output" in remote debug HOT 1
- βI/O operation on closed fileβ when try with "Debugging from a separate terminal" HOT 12
- Error reported when exiting iPython and returning to UI on Mac OS X HOT 3
- Please make this marvel run well on a-Shell app for iPad HOT 1
- "Debugger instance already exists" when used in pytest HOT 5
- Greyscale Theme HOT 4
- New Release HOT 1
- Unable to use `--pdb --pdbcls=pudb.debugger:Debugger` with latest versions of urwid HOT 2
- telnetlib (used for remote debugger) is deprecated in Python 3.12 HOT 4
- Run to line in the same frame HOT 1
- Allow setting term size via env var HOT 1
- PUDB freezes at welcome screen HOT 2
- export PUDB_TTY=... not working HOT 1
- how can i see or get the current debugged file path?
- Ipython StartUp Script for pudb python shell. HOT 3
- remote debugging with telnet fails: a Debugger instance already exists HOT 2
- 2024.1 display clobbered with internal pudb [DEBUG] messages. HOT 11
- Variable ListBox crashes for long variables repr HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pudb.