Y
Yaþar Arabacý
Hi people,
I wrote this decorator: https://gist.github.com/yasar11732/7163528
When this code executes:
@debugging
def myfunc(a, b, c, d = 48):
a = 129
return a + b
print myfunc(12,15,17)
This is printed:
function myfunc called
a 12
c 17
b 15
d 48
assigned new value to a: 129
returning 144
144
I think I can be used instead of inserting and deleting print
statements when trying to see what is
passed to a function and what is assingned to what etc. I think it can
be helpful during debugging.
It works by rewriting ast of the function and inserting print nodes in it.
What do you think?
I wrote this decorator: https://gist.github.com/yasar11732/7163528
When this code executes:
@debugging
def myfunc(a, b, c, d = 48):
a = 129
return a + b
print myfunc(12,15,17)
This is printed:
function myfunc called
a 12
c 17
b 15
d 48
assigned new value to a: 129
returning 144
144
I think I can be used instead of inserting and deleting print
statements when trying to see what is
passed to a function and what is assingned to what etc. I think it can
be helpful during debugging.
It works by rewriting ast of the function and inserting print nodes in it.
What do you think?