Debugging decorator

Chris Angelico rosuav at gmail.com
Mon Oct 28 09:00:53 EDT 2013


On Mon, Oct 28, 2013 at 11:43 PM, Schneider <js at globe.de> wrote:
> 2. In the case of an assignment (but holds for the return statement too).
> think about the following code:
>
> a = 0
> @debugging
> def foo():
>     a = a +  1
>
> def bar():
>     #assign something else to a
>
> Imagine foo() and bar() being called in two different threads.

I think threading considerations are rather outside the scope of this
tool. If you're trying to figure out what happens when two threads
mutate the same global, you really want something a lot more
heavy-duty... possibly static code analysis to work out what *might*
happen, rather than what *did* happen this particular run.

ChrisA



More information about the Python-list mailing list