Debugging decorator

2013-11-03 Thread Yaşar Arabacı
I don't think it would be much problem. I can do that when I have spare time. Yasar. > Oh, I just noticed that the person using 2to3 wasn't the OP. My > apologies, my language was aimed at the decorator's primary developer. > Yasar, are you prepared to take on Python 3 support fully? If it's as >

Re: Debugging decorator

2013-11-03 Thread Chris Angelico
On Sun, Nov 3, 2013 at 9:55 PM, Jason Friedman wrote: > >> I wrote this decorator: https://gist.github.com/yasar11732/7163528 >> > I ran it with Python 2 and thought it was neat. > Most of my work is Python 3. > I ran 2to3-3.3 against it and I am getting this error: > > $ ./simple.py > Traceback (

Re: Debugging decorator

2013-11-03 Thread Chris Angelico
On Mon, Nov 4, 2013 at 12:20 AM, Chris Angelico wrote: > As print is now a function, you're going to need to construct a > function call element instead of a special 'print' node. I don't know > how to do that as I'm not an AST expert, but hopefully you can work it > out from there? > > If you nee

Re: Debugging decorator

2013-11-03 Thread Jason Friedman
> I wrote this decorator: https://gist.github.com/yasar11732/7163528 > > I ran it with Python 2 and thought it was neat. Most of my work is Python 3. I ran 2to3-3.3 against it and I am getting this error: $ ./simple.py Traceback (most recent call last): File "./simple.py", line 3, in @debug

Re: Debugging decorator

2013-10-28 Thread Chris Angelico
On Mon, Oct 28, 2013 at 11:43 PM, Schneider 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 c

Re: Debugging decorator

2013-10-28 Thread Schneider
helpful during debugging. It works by rewriting ast of the function and inserting print nodes in it. What do you think? Looks very nice, but I've three questions: 1. What happens, if a function has more then one decorator? Wouldn't it be better to just remove the debugging decorat

Re: Debugging decorator

2013-10-27 Thread Eric S. Johansson
On 10/25/2013 7:55 PM, Yaşar Arabacı wrote: Hi people, I wrote this decorator: https://gist.github.com/yasar11732/7163528 wow, this looks really powerful. I would like to add the ability to associate a tag or set of tags with the decorator so that the debug output only happens when there is

Re: Debugging decorator

2013-10-25 Thread Chris Angelico
On Sat, Oct 26, 2013 at 10:55 AM, Yaşar Arabacı wrote: > 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 th

Debugging decorator

2013-10-25 Thread 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 4