[Python-Dev] PyDict_SetItem hook (original) (raw)

Collin Winter collinw at gmail.com
Thu Apr 2 02:31:29 CEST 2009


On Wed, Apr 1, 2009 at 4:29 PM, John Ehresman <jpe at wingware.com> wrote:

I've written a proof of concept patch to add a hook to PyDictSetItem at  http://bugs.python.org/issue5654  My motivation is to enable watchpoints in a python debugger that are called when an attribute or global changes.  I know that this won't cover function locals and objects with slots (as Martin pointed out).

We talked about this at the sprints and a few issues came up: * Is this worth it for debugger watchpoint support?  This is a feature that probably wouldn't be used regularly but is extremely useful in some situations. * Would it be better to create a namespace dict subclass of dict, use it for modules, classes, & instances, and only allow watches of the subclass instances? * To what extent should non-debugger code use the hook?  At one end of the spectrum, the hook could be made readily available for non-debug use and at the other end, it could be documented as being debug only, disabled in python -O, & not exposed in the stdlib to python code.

Have you measured the impact on performance?

Collin



More information about the Python-Dev mailing list