How to inspect a variable (sys.modules) for changes in the execution of a program?
Chris Rebert
clp2 at rebertia.com
Tue Feb 15 13:19:07 EST 2011
More information about the Python-list mailing list
Tue Feb 15 13:19:07 EST 2011
- Previous message (by thread): How to inspect a variable (sys.modules) for changes in the execution of a program?
- Next message (by thread): How to inspect a variable (sys.modules) for changes in the execution of a program?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Feb 15, 2011 at 7:17 AM, Jorge Vargas <jorge.vargas at gmail.com> wrote: > Hello, > > I have the following situation. In a big project that involves many > dependencies (and sadly some sys.module hacks) we have a bug, and it > will really help if i could monitor all changes made to that variable. > Is there a way to trace those changes ? Is the variable's value of a mutable or immutable type? What is the variable's scope (e.g. module-level global, or object attribute)? Is the variable subject to getting rebound to an entirely new value/object? The answers to these questions will determine how much work will be required to trace "changes" to the variable. I know of no built-in way to directly do such a thing, but the underlying functionality necessary to implement such a feature (e.g. sys.settrace, __getattribute__, __setattr__) does exist. Cheers, Chris -- http://blog.rebertia.com
- Previous message (by thread): How to inspect a variable (sys.modules) for changes in the execution of a program?
- Next message (by thread): How to inspect a variable (sys.modules) for changes in the execution of a program?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list